System.Xml.XmlConvert.ToDateTimeOffset Method

Converts the supplied string to a DateTimeOffset equivalent.

Syntax

public static DateTimeOffset ToDateTimeOffset (string s, string format)

Parameters

s
The string to convert.
format
The format from which s is converted. The format parameter can be any subset of the W3C Recommendation for the XML dateTime type. (For more information see http://www.w3.org/TR/xmlschema-2/#dateTime.) The string s is validated against this format.

Returns

The DateTimeOffset equivalent of the supplied string.

Remarks

If the offset specified within the input string will cause an overflow in the deserialized representation of the DateTimeOffset, a FormatException is thrown.

When more than seven digits are specified for fractional seconds, the value is rounded. For example, 00000004 becomes 0000000 and 00000005 becomes 0000001.

Requirements

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