|
Strings formatieren mit C# | c | Währung (currency) | string.Format("{0:c}",Wert) | 1.000.000,00 € | | d | Dezimalzahl (decimal) | string.Format("{0:d}",Wert) | 1000000 | | e | Wissenschaftlich (scientific) | string.Format("{0:e}",Wert) | 1,000000e+006 | | f | Festkommazahl (fixed point) | string.Format("{0:f}",Wert) | 1000000,00 | | g | Generisch (general) | string.Format("{0:g}",Wert) | 1000000 | | n | Tausender Trennzeichen | string.Format("{0:n}",Wert) | 1.000.000,00 | | x | Hexadezimal | string.Format("{0:x4}",Wert) | f4240 | Zahlen individuell formatieren (Wert = 1000000) | 0 | 0-Platzhalter | string.Format("{0:00.0000}",Wert) | 1000000,0000 | | # | Zahl-Platzhalter | string.Format("{0:(#).##}",Wert) | (1000000) | | . | Dezimalpunkt | string.Format("{0:0.0}",Wert) | 1000000,0 | | , | Tausender Trennzeichen | string.Format("{0:0,0}",Wert) | 1.000.000 | | ,. | Ganzzahliges Vielfaches von 1.000 | string.Format("{0:0,.}",Wert) | 1000 | | % | Prozentwert | string.Format("{0:0%}",Wert) | 100000000% | | e | Exponenten-Platzhalter | string.Format("{0:00e+0}",Wert) | 10e+5 | Datumswerte formatieren (Wert = aktuelles Datum = System.DateTime.Now) | d | kurzes Datumsformat | string.Format("{0:d}",Wert) | 25.04.2009 | | D | langes Datumsformat | string.Format("{0:D}",Wert) | Samstag, 25. April 2009 | | t | kurzes Zeitformat | string.Format("{0:t}",Wert) | 22:17 | | T | langes Zeitformat | string.Format("{0:T}",Wert) | 22:17:36 | | f | Datum & Uhrzeit komplett (kurz) | string.Format("{0:f}",Wert) | Samstag, 25. April 2009 22:17 | | F | Datum & Uhrzeit komplett (lang) | string.Format("{0:F}",Wert) | Samstag, 25. April 2009 22:17:36 | | g | Standard-Datum (kurz) | string.Format("{0:g}",Wert) | 25.04.2009 22:17 | | G | Standard-Datum (lang) | string.Format("{0:G}",Wert) | 25.04.2009 22:17:36 | | M | Tag des Monats | string.Format("{0:M}",Wert) | 25 April | | r | RFC1123 Datumsformat | string.Format("{0:r}",Wert) | Sat, 25 Apr 2009 22:17:36 GMT | | s | sortierbares Datumsformat | string.Format("{0:s}",Wert) | 2009-04-25T22:17:36 | | u | universell sortierbares Datumsformat | string.Format("{0:u}",Wert) | 2009-04-25 22:17:36Z | | U | universell sortierbares GMT-Datumsformat | string.Format("{0:U}",Wert) | Samstag, 25. April 2009 20:17:36 | | Y | Jahr/Monats-Muster | string.Format("{0:Y}",Wert) | April 2009 | Datumswerte individuell formatieren (Wert = aktuelles Datum = System.DateTime.Now) | dd | Tag | string.Format("{0:dd}",Wert) | 25 | | ddd | Tagname (Kürzel) | string.Format("{0:ddd}",Wert) | Sa | | dddd | Tagname (ausgeschrieben) | string.Format("{0:dddd}",Wert) | Samstag | | gg | Ära | string.Format("{0:gg}",Wert) | n. Chr. | | hh | Stunde 2stellig | string.Format("{0:hh}",Wert) | 10 | | HH | Stunde 2stellig (24-Stunden) | string.Format("{0:HH}",Wert) | 22 | | mm | Minute | string.Format("{0:mm}",Wert) | 17 | | MM | Monat | string.Format("{0:MM}",Wert) | 04 | | MMM | Monatsname (Kürzel) | string.Format("{0:MMM}",Wert) | Apr | | MMMM | Monatsname (ausgeschrieben) | string.Format("{0:MMMM}",Wert) | April | | ss | Sekunde | string.Format("{0:ss}",Wert) | 36 | | tt | AM oder PM (nur englisch) | string.Format("{0:tt}",Wert) | | | yy | Jahr 2stellig | string.Format("{0:yy}",Wert) | 09 | | yyyy | Jahr 4stellig | string.Format("{0:YY}",Wert) | 2009 | | zz | Zeitzone (kurz) | string.Format("{0:zz}",Wert) | +02 | | zzz | Zeitzone (lang) | string.Format("{0:zzz}",Wert) | +02:00 |
|