System.Xml.XmlConvert.ToDateTime Method

Converts the string to a DateTime equivalent.

Syntax

[System.Obsolete]
public static DateTime ToDateTime (string s)

Parameters

s
The string to convert.

Returns

A DateTime equivalent of the string.

Exceptions

TypeReason
ArgumentNullException s is a null reference.
FormatException s is string.Empty or is not in the correct format.

Remarks

Note:

The XmlConvert.ToDateTime(string) method is obsolete in the 2.0 version of the .NET Framework and has been replaced by the XmlConvert.ToDateTime(string, XmlDateTimeSerializationMode) method.

Requirements

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