XmlConvert.ToTimeSpan Method (String)

 

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.

Exception Condition
FormatException

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

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: