Click or drag to resize
TimeSpanParse Method (String)
Converts the string representation of a time interval to its TimeSpan equivalent.

Namespace: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public static TimeSpan Parse(
	string s
)

Parameters

s
Type: SystemString
A string that specifies the time interval to convert.

Return Value

Type: TimeSpan
A time interval that corresponds to s.
Exceptions
ExceptionCondition
ArgumentNullExceptions is null.
FormatExceptions has an invalid format.
OverflowExceptions represents a number that is less than MinValue or greater than MaxValue.-or- At least one of the days, hours, minutes, or seconds components is outside its valid range.
See Also