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 specifier column indicates the format string, 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 using the Date/Time control panel in Microsoft Windows, by passing your own DateTimeFormatInfo class as the format provider, or by passing a CultureInfo class set to a different culture. Note that changing the culture does not influence the output produced by the 'r' and 's' formats.

Format specifier Current culture Output
d en-US 4/10/2001
d en-NZ 10/04/2001
d de-DE 10.04.2001
D en-US Tuesday, April 10, 2001
T en-US 3:51:24 PM
T es-ES 15:51:24
f en-US Tuesday, April 10, 2001 3:51 PM
f fr-FR mardi 10 avril 2001 15:51
r en-US Tue, 10 Apr 2001 15:51:24 GMT
r zh-SG Tue, 10 Apr 2001 15:51:24 GMT
s en-US 2001-04-10T15:51:24
s pt-BR 2001-04-10T15:51:24
u en-US 2001-04-10 15:51:24Z
u sv-FI 2001-04-10 15:51:24Z
m en-US April 10
m ms-MY 10 April
y en-US April, 2001
y af-ZA April 2001
L en-UZ Unrecognized format specifier; a format exception is thrown.

See Also

Formatting Overview | Formatting Types | Standard DateTime Format Strings | Custom DateTime Format Strings