Mono Class Library: System.DateTime Overview | Members

System.DateTime.ToString Method

Returns a string representation of the value of the current instance. [Edit]

public string ToString (string format)

Parameters

format
A string that specifies the format of the returned string.
Note: For a list of valid values, see System.Globalization.DateTimeFormatInfo .
[Edit]

Returns

A string representation of the current instance formatted as specified by format. The string takes into account the current system culture. [Edit]

Exceptions

TypeReason
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.

[Edit]

Remarks

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.

[Edit]

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0