# Standard Date/Time Format Strings

A standard DateTime format string consists of a single format specifier character from the following table. If the format specifier is not found in the table below, a runtime exception is thrown. 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 (Control Panel - Regional and Language options - Regional Options - Advanced). Computers with different cultures or different date and time settings will generate different result strings.

The date and time separators displayed by format strings are defined by the DateSeparator and TimeSeparator characters associated with the DateTimeFormat property of the Regional Settings. However, in cases where the InvariantCulture is referenced by the 'r', 's', and 'u' specifiers, the characters associated with the DateSeparator and TimeSeparator characters do not change based on the current culture.

The following table describes the standard format specifiers:

Format Specifier | Name | Description
--- | --- | ---
d | Short date pattern | Displays a pattern defined by the Short Date Pattern property.
D | Long date pattern | Displays a pattern defined by the Long Date Pattern property.
t | Short time pattern | Displays a pattern defined by the Short Time Pattern property.
T | Long time pattern | Displays a pattern defined by the Long Time Pattern property.
f | Full date/time pattern (short time) | Displays a combination of the long date and short time patterns, separated by a space.
F | Full date/time pattern (long time) | Displays a pattern defined by the Full Date Time Pattern property.
g | General date/time pattern (short time) | Displays a combination of the short date and short time patterns, separated by a space.
G | General date/time pattern (long time) | Displays a combination of the short date and long time patterns, separated by a space.
M or m | Month day pattern | Displays a pattern defined by the Month Day Pattern property.
R or r | RFC1123 pattern | Displays a pattern defined by the RFC1123. This is a defined standard; therefore, it is always the same regardless of the culture used, or the format provider supplied. The format follows the custom pattern "ddd, dd MMM yyyy HH:mm:ss G\MT". Note that the 'M' in "GMT" needs an escape character so it is not interpreted. Formatting does not modify the value of the DateTime; therefore, you must adjust the value to GMT before formatting.
s | Sortable date/time pattern; conforms to ISO 8601 | Displays a pattern defined by ISO 8601, which is defined by the custom pattern "yyyy-MM-ddTHH:mm:ss".
u | Universal sortable date/time pattern | Displays a pattern similar to ISO 8601, including the time zone. Because it is a defined standard and the property is read-only, the pattern is always the same regardless of culture or format provider. Formatting follows the custom pattern "yyyy-MM-dd HH:mm:ssZ". No time zone conversion is done when the date and time is formatted; therefore, convert a local date and time to universal time before using this format specifier.
U | Universal sortable date/time pattern | Displays a pattern similar to ISO 8601, including the time zone. Because it is a defined standard and the property is read-only, the pattern is always the same regardless of culture or format provider. Formatting follows the custom pattern "yyyy-MM-dd HH:mm:ssZ". The time displayed is the universal time, rather than the local time, equivalent to the DateTime value.
Y or y | Year month pattern | Displays a pattern defined by the Year Month Pattern property.
Any other single character | Unknown specifier |