XmlConvert::ToDateTime Method (String^, XmlDateTimeSerializationMode)

 

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.

Exception Condition
NullReferenceException

s is null.

ArgumentNullException

The dateTimeOption value is null.

FormatException

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

Universal Windows Platform
Available since 10
.NET Framework
Available since 2.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: