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

System.Xml.XmlConvert.ToDateTime Method

Converts a string to a DateTime equivalent.

public static DateTime ToDateTime (string s, string format)

Parameters

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

Returns

The DateTime equivalent of s.

Exceptions

TypeReason
ArgumentNullExceptions is a null reference.
FormatException

s or format is string.Empty .

-or-

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

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.

Requirements

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