ParseTimeSpan

Duration.ParseTimeSpan method

Parses duration string in format “PT–H–M–S–”.

public static TimeSpan ParseTimeSpan(string value)
ParameterTypeDescription
valueStringthe specified string to parse.

Return Value

returns parsed instance of the TimeSpan struct.

Examples

Shows how to convert a string into a time span.

var timeSpan = Duration.ParseTimeSpan("PT1H10M30S");
Console.WriteLine("The parsed time span: " + timeSpan);

See Also