Share via


Date and Time Format Strings

DateTime format strings are used to control the formatting produced when a date or time is represented as a string.

The DateTime data type implements IFormattable, allowing it to be formatted as a string with one of the overloads of DateTime.ToString. The output of the standard format strings is influenced by the current culture. The standard .NET Framework format provider class is DateTimeFormatInfo, which can be obtained from a passed CultureInfo object or the one associated with the current thread.

DateTime format strings fall into two categories: standard format strings and custom format strings. The custom format strings allow DateTime objects to be formatted for situations where the standard formatting strings are not useful.

See Also

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