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
Assembly: System.Xml (in System.Xml.dll)
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.
| Exception | Condition |
|---|---|
| NullReferenceException | The dateTimeOption value is null. |
| FormatException | s is an empty string or is not in a valid format. |
Show: