Share via


Standard DateTime Format Strings Output Examples 

The following table illustrates the output created by applying some standard DateTime format strings to a particular date and time. Output was produced using the ToString method.

The Format string column indicates the format specifier, the Culture column indicates the culture associated with the current thread, and the Output column indicates the result of formatting.

The different culture values demonstrate the impact of changing the current culture. The culture can be changed by the settings in the Regional and Language Options item in Control Panel, or by passing your own DateTimeFormatInfo or CultureInfo class as the format provider. Note that changing the culture does not influence the output produced by the 'r' and 's' formats.

Short Date Pattern

Format string Current culture Output

d

en-US

4/10/2001

d

en-NZ

10/04/2001

d

de-DE

10.04.2001

Long Date Pattern


Format string Current culture Output

D

en-US

Tuesday, April 10, 2001

Long Time Pattern

Format string Current culture Output

T

en-US

3:51:24 PM

T

es-ES

15:51:24

Full Date/Time Pattern (Short Time)


Format string Current culture Output

f

en-US

Tuesday, April 10, 2001 3:51 PM

f

fr-FR

mardi 10 avril 2001 15:51

RFC1123 Pattern

Format string Current culture Output

r

en-US

Tue, 10 Apr 2001 15:51:24 GMT

r

zh-SG

Tue, 10 Apr 2001 15:51:24 GMT

Sortable Date/Time Pattern (ISO 8601)


Format string Current culture Output

s

en-US

2001-04-10T15:51:24

s

pt-BR

2001-04-10T15:51:24

Universal Sortable Date/Time Pattern

Format string Current culture Output

u

en-US

2001-04-10 15:51:24Z

u

sv-FI

2001-04-10 15:51:24Z

Month Day Pattern


Format string Current culture Output

m

en-US

April 10

m

ms-MY

10 April

Year Month Pattern

Format string Current culture Output

y

en-US

April, 2001

y

af-ZA

April 2001

An Invalid Pattern


Format string Current culture Output

L

en-UZ

Unrecognized format specifier; a format exception is thrown.

See Also

Concepts

Formatting Overview
Standard DateTime Format Strings
Custom DateTime Format Strings

Other Resources

Formatting Types