Returns a string representation of the value of the current instance.
- format
- A string that specifies the format of the returned string.
Note: For a list of valid values, see System.Globalization.DateTimeFormatInfo .
A string representation of the current instance formatted as specified by format. The string takes into account the current system culture.
Type Reason FormatException The length of the format string is 1, and it is not one of the format specifier characters defined for System.Globalization.DateTimeFormatInfo.
-or-
The format string does not contain a valid custom format pattern.
This version of DateTime.ToString is equivalent to DateTime.ToString (format , null ).
If format is a null reference, the general format specifier "G" is used.
Note:This method uses the culture information of the current thread.
For information on formatting system-supplied data types, see the IFormattable interface.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0