ToTimeSpan Method

XmlConvert.ToTimeSpan Method

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

Converts the String to a TimeSpan equivalent.

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

public static TimeSpan ToTimeSpan(
	string s
)

Parameters

s
Type: System.String
The string to convert. The string format must conform to the W3C XML Schema Part 2: Datatypes recommendation for duration.

Return Value

Type: System.TimeSpan
A TimeSpan equivalent of the string.

ExceptionCondition
FormatException

s is not in correct format to represent a TimeSpan value.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft