C# custom format to C / POSIX strftime.
13 of 20 fields map cleanly; 7 have no C / POSIX strftime token.
C / POSIX strftime
%Y-%m-%d %H:%M
Reference · Mon, Jan 2 2006, 3:04:05 PM MST
2006-01-02 15:04
2006-01-02 15:04
Right now, your zone
…
Both sides render the same instant — the translation is faithful.
| C# custom format | C / POSIX strftime | Field | Example |
|---|---|---|---|
| yyyy | %Y | Four-digit year | 2006 |
| yy | %y | Two-digit year | 06 |
| M | no token | Month number | 1 |
| MM | %m | Month number, padded | 01 |
| MMM | %b | Month name, abbreviated | Jan |
| MMMM | %B | Month name, full | January |
| d | no token | Day of month | 2 |
| dd | %d | Day of month, padded | 02 |
| ddd | %a | Weekday, abbreviated | Mon |
| dddd | %A | Weekday, full | Monday |
| H | no token | Hour, 24-hour clock | 15 |
| HH | %H | Hour, 24-hour clock, padded | 15 |
| h | no token | Hour, 12-hour clock | 3 |
| hh | %I | Hour, 12-hour clock, padded | 03 |
| tt | %p | AM/PM marker | PM |
| mm | %M | Minute, padded | 04 |
| ss | %S | Second, padded | 05 |
| fff | no token | Fractional seconds | 000 |
| zzz | no token | UTC offset, extended | -07:00 |
| g | no token | Era | AD |