The .NET Framework defines standard and custom format specifiers for formatting numbers, dates and times, and enumerations. Format specifiers are used by various methods that format output strings, such as Console..::.WriteLine and the individual overloads of the ToString method of certain types, and by some methods that parse input strings, such as Parse and DateTime..::.ParseExact.
For information about formatting numeric data, see Numeric Format Strings. For a table of commonly used numeric format specifiers, see Standard Numeric Format Strings, and for a table of custom format specifiers you can use to create your own format string, see Custom Numeric Format Strings.
For information about formatting dates and times, see Date and Time Format Strings. For a table of commonly used date and time format specifiers, see Standard DateTime Format Strings, and for a table of custom date and time format specifiers you can use to create your own format string, see Custom DateTime Format Strings.
For information on performing some specific formatting operations, such as extracting the day of the week from a specific date or displaying the date using a non-Gregorian calendar, see Formatting How-to Topics.
For information about formatting enumerations, and a table of standard enumeration format specifiers, see Enumeration Format Strings.
Parsing and Format Specifiers
Formatting converts the value of a type into a string representation; parsing, the inverse of formatting, creates a data type from a string representation. A format provider governs how parsing is performed, and some methods, such as DateTime..::.ParseExact, take a format specifier parameter that indicates the expected format of the string representation. For more information about parsing, see Parsing Strings.
ToString and Format Specifiers
The .NET Framework supports overloading a type's default ToString method, which performs rudimentary formatting, with a specialized version of ToString that uses a format specifier parameter to indicate how the value is to be formatted. For more information, see Formatting Base Types and the IFormattable interface.