Standard date and time format

This page describes the standard date and time format specifiers.

Format specifierDescriptionExamples

"d"

Short date pattern. More information:The Short Date ("d") Format Specifier.

2009-06-15T13:45:30 -> 6/15/2009 (en-US) 2009-06-15T13:45:30 -> 15/06/2009 (fr-FR) 2009-06-15T13:45:30 -> 2009/06/15 (ja-JP)

"D"

Long date pattern. More information:The Long Date ("D") Format Specifier.

2009-06-15T13:45:30 -> Monday, June 15, 2009 (en-US) 2009-06-15T13:45:30 -> 15 июня 2009 г. (ru-RU) 2009-06-15T13:45:30 -> Montag, 15. Juni 2009 (de-DE)

"f"

Full date/time pattern (short time). More information: The Full Date Short Time ("f") Format Specifier.

2009-06-15T13:45:30 -> Monday, June 15, 2009 1:45 PM (en-US) 2009-06-15T13:45:30 -> den 15 juni 2009 13:45 (sv-SE) 2009-06-15T13:45:30 -> Δευτέρα, 15 Ιουνίου 2009 1:45 μμ (el-GR)

"F"

Full date/time pattern (long time). More information: The Full Date Long Time ("F") Format Specifier.

2009-06-15T13:45:30 -> Monday, June 15, 2009 1:45:30 PM (en-US) 2009-06-15T13:45:30 -> den 15 juni 2009 13:45:30 (sv-SE) 2009-06-15T13:45:30 -> Δευτέρα, 15 Ιουνίου 2009 1:45:30 μμ (el-GR)

"g"

General date/time pattern (short time). More information: The General Date Short Time ("g") Format Specifier.

2009-06-15T13:45:30 -> 6/15/2009 1:45 PM (en-US) 2009-06-15T13:45:30 -> 15/06/2009 13:45 (es-ES) 2009-06-15T13:45:30 -> 2009/6/15 13:45 (zh-CN)

"G"

General date/time pattern (long time). More information: The General Date Long Time ("G") Format Specifier.

2009-06-15T13:45:30 -> 6/15/2009 1:45:30 PM (en-US) 2009-06-15T13:45:30 -> 15/06/2009 13:45:30 (es-ES) 2009-06-15T13:45:30 -> 2009/6/15 13:45:30 (zh-CN)

"M", "m"

Month/day pattern. More information: The Month ("M", "m") Format Specifier.

2009-06-15T13:45:30 -> June 15 (en-US) 2009-06-15T13:45:30 -> 15. juni (da-DK) 2009-06-15T13:45:30 -> 15 Juni (id-ID)

"O", "o"

Round-trip date/time pattern. More information: The Round-trip ("O", "o") Format Specifier.

DateTime values: 2009-06-15T13:45:30 (DateTimeKind.Local) --> 2009-06-15T13:45:30.0000000-07:00 2009-06-15T13:45:30 (DateTimeKind.Utc) --> 2009-06-15T13:45:30.0000000Z 2009-06-15T13:45:30 (DateTimeKind.Unspecified) --> 2009-06-15T13:45:30.0000000 DateTimeOffset values: 2009-06-15T13:45:30-07:00 --> 2009-06-15T13:45:30.0000000-07:00

"R", "r"

RFC1123 pattern. More information: The RFC1123 ("R", "r") Format Specifier.

2009-06-15T13:45:30 -> Mon, 15 Jun 2009 20:45:30 GMT

"s"

Sortable date/time pattern. More information: The Sortable ("s") Format Specifier.

2009-06-15T13:45:30 (DateTimeKind.Local) -> 2009-06-15T13:45:30 2009-06-15T13:45:30 (DateTimeKind.Utc) -> 2009-06-15T13:45:30

"t"

Short time pattern. More information: The Short Time ("t") Format Specifier.

2009-06-15T13:45:30 -> 1:45 PM (en-US) 2009-06-15T13:45:30 -> 13:45 (hr-HR) 2009-06-15T13:45:30 -> 01:45 م (ar-EG)

"T"

Long time pattern. More information: The Long Time ("T") Format Specifier.

2009-06-15T13:45:30 -> 1:45:30 PM (en-US) 2009-06-15T13:45:30 -> 13:45:30 (hr-HR) 2009-06-15T13:45:30 -> 01:45:30 م (ar-EG)

"u"

Universal sortable date/time pattern. More information: The Universal Sortable ("u") Format Specifier.

With a DateTime value: 2009-06-15T13:45:30 -> 2009-06-15 13:45:30Z With a DateTimeOffset value: 2009-06-15T13:45:30 -> 2009-06-15 20:45:30Z

"U"

Universal full date/time pattern. More information: The Universal Full ("U") Format Specifier.

2009-06-15T13:45:30 -> Monday, June 15, 2009 8:45:30 PM (en-US) 2009-06-15T13:45:30 -> den 15 juni 2009 20:45:30 (sv-SE) 2009-06-15T13:45:30 -> Δευτέρα, 15 Ιουνίου 2009 8:45:30 μμ (el-GR)

"Y", "y"

Year month pattern. More information: The Year Month ("Y") Format Specifier.

2009-06-15T13:45:30 -> June 2009 (en-US) 2009-06-15T13:45:30 -> juni 2009 (da-DK) 2009-06-15T13:45:30 -> Juni 2009 (id-ID)

Any other single character

Unknown specifier.

Throws a run-time FormatException.

Last updated