DateTime..::..ToString Method (String)
Converts the value of the current DateTime object to its equivalent string representation using the specified format.
Namespace:
SystemAssembly: Bridge (in Bridge.dll)
Syntax
[TemplateAttribute] public string ToString( string format )
<TemplateAttribute> _ Public Function ToString ( _ format As String _ ) As String
[TemplateAttribute] public: String^ ToString( String^ format )
Parameters
- format
- Type: System..::..String
A standard or custom date and time format string (see Remarks).
Return Value
A string representation of value of the current DateTime object as specified by format.Exceptions
Exception | Condition |
---|---|
System..::..FormatException | The length of format is 1, and it is not one of the format specifier characters defined for DateTimeFormatInfo.-or- format does not contain a valid custom format pattern. |
System..::..ArgumentOutOfRangeException | The date and time is outside the range of dates supported by the calendar used by the current culture. |