NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DateTime.ToString (DateTime)

Converts the date and time value of a specified DateTime to a String.

[Visual Basic]
Overloads Public Shared Function ToString( _
   ByVal dt As DateTime _
) As String
[C#]
public static string ToString(
   DateTime dt
);
[C++]
public: static String* ToString(
   DateTime dt
);
[JScript]
public static function ToString(
   dt : DateTime
) : String;

Parameters

dt
The DateTime value to be converted.

Return Value

A string value containing the date and time that the specified DateTime instance represents.

Exceptions

Exception Type Condition
FormatException If the general format ("G") string is used.

Remarks

The ToString method uses InvariantCulture as default. The output of ToString must be consumable by FromString.

An unexpected FormatException occurs while using the ToSring general format ("G) string when the general format DateTime string representation is not parsed correctly.

Note   ToString is formatted using the invariant culture (see InvariantCulture).
Note   ToString converts the date and time value of a specified DateTime to a string value, then formats the return value determined by the InvariantCulture For example, the English (United States) format is " mm/dd/yy hh:mm:ss
PP ", where:

See Also

DateTime Structure | DateTime Members | System Namespace | DateTime.ToString Overload List | String | DateTimeFormat | CultureInfo | Calendar | DateTimeFormatInfo