Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

XmlConvert::ToDateTime Method (String^, String^)

 

Converts the String to a DateTime equivalent.

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

public:
static DateTime ToDateTime(
	String^ s,
	String^ format
)

Parameters

s
Type: System::String^

The string to convert.

format
Type: System::String^

The format structure to apply to the converted DateTime. Valid formats include "yyyy-MM-ddTHH:mm:sszzzzzz" and its subsets. The string is validated against this format.

Return Value

Type: System::DateTime

A DateTime equivalent of the string.

Exception Condition
ArgumentNullException

s is null.

FormatException

s or format is String.Empty

-or-

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

.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2017 Microsoft