ToDateTime Method (String, XmlDateTimeSerializationMode)
Collapse the table of content
Expand the table of content

XmlConvert.ToDateTime Method (String, XmlDateTimeSerializationMode)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Converts the String to a DateTime using the XmlDateTimeSerializationMode specified

Namespace:  System.Xml
Assembly:  System.Xml (in System.Xml.dll)

public static DateTime ToDateTime(
	string s,
	XmlDateTimeSerializationMode dateTimeOption
)

Parameters

s
Type: System.String
The String value to convert.
dateTimeOption
Type: System.Xml.XmlDateTimeSerializationMode
One of the XmlDateTimeSerializationMode values that specify whether the date should be converted to local time or preserved as Coordinated Universal Time (UTC), if it is a UTC date.

Return Value

Type: System.DateTime
A DateTime equivalent of the String.

ExceptionCondition
NullReferenceException

The dateTimeOption value is null.

FormatException

s is an empty string or is not in a valid format.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft