Standard Date/Time Format Strings

A standard Date Time format string consists of a single format specifier character from the following table. If the format string is longer than a single character (even if the extra characters are white spaces), the format string is interpreted as a custom format string. Note that the result string produced by these format specifiers are influenced by the settings in the Regional Options control panel. Computers with different cultures or different date and time settings will generate different result strings.

CharacterDescription
dShort date pattern. Displays the short date format based on the current culture (e.g.: en-US culture: M/d/yyyy).
DLong date pattern. Displays the long date format based on the current culture (e.g.: en-US culture: dddd, MMMM dd, yyyy).
tShort time pattern. Displays the short time format based on the current culture (e.g.: en-US culture: h:mm tt).
TLong time pattern. Displays the long time format based on the current culture (e.g.: en-US culture: h:mm:ss tt).
fFull date/time pattern (short time). Displays a combination of the long date and short time patterns, separated by a space (e.g.: en-US culture: dddd, MMMM dd, yyyy h:mm tt).
FFull date/time pattern (long time). Displays a combination of the long date and long time patterns, separated by a space (e.g.: en-US culture: dddd, MMMM dd, yyyy h:mm:ss tt).
gGeneral date/time pattern (short time). Displays a combination of the short date and short time patterns, separated by a space (e.g.: en-US culture: M/d/yyyy h:mm tt).
GGeneral date/time pattern (long time). Displays a combination of the short date and long time patterns, separated by a space (e.g.: en-US culture: M/d/yyyy h:mm:ss tt).
oOrdinal ("Julian") date pattern. Displays the ordinal date format defined by the custom pattern yyyy-ooo.
OOrdinal ("Julian") date pattern. Displays the ordinal date format defined by the custom pattern yyyyooo.
sSort able date/time pattern. Displays a pattern defined by the custom pattern "yyyy-MM-ddTHH:mm:ss" for all cultures.
M, mMonth, day pattern. Displays month, day format based on the current culture (e.g.: en-US culture: MMMM dd).
Y, yYear, month pattern. Displays year, month format based on the current culture (e.g.: en-US culture: MMMM, yyyy).