XmlConvert.ToString Method (DateTime, XmlDateTimeSerializationMode)

 

Converts the DateTime to a String using the XmlDateTimeSerializationMode specified.

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

public static string ToString(
	DateTime value,
	XmlDateTimeSerializationMode dateTimeOption
)

Parameters

value
Type: System.DateTime

The DateTime value to convert.

dateTimeOption
Type: System.Xml.XmlDateTimeSerializationMode

One of the XmlDateTimeSerializationMode values that specify how to treat the DateTime value.

Return Value

Type: System.String

A String equivalent of the DateTime.

Exception Condition
ArgumentException

The dateTimeOption value is not valid.

ArgumentNullException

The value or dateTimeOption value is null.

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: