Mono Class Library: System.Xml.XmlConvert Overview | Members

System.Xml.XmlConvert.ToDateTime Method

Converts a string to a DateTime equivalent. [Edit]

public static DateTime ToDateTime (string s, string format)

Parameters

s
The string to convert. [Edit]
format
A string specifying the format used to validate s. [Edit]
format
Documentation for this section has not yet been entered. [Edit]

Returns

The DateTime equivalent of s. [Edit]

Exceptions

TypeReason
ArgumentNullExceptions is a null reference. [Edit]
FormatException

s or format is string.Empty .

-or-

s does not contain a date and time that corresponds to format.

[Edit]

Remarks

This method calls DateTime.ParseExact(string, string, IFormatProvider)(s, format, System.Globalization.DateTimeFormatInfo.InvariantInfo, System.Globalization.DateTimeStyles.AllowLeadingWhite|System.Globalization.DateTimeStyles.AllowTrailingWhite).

Valid formats include "yyyy-MM-ddTHH:mm:sszzzzzz" and its subsets.

[Edit]

Requirements

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