Mono Class Library: System.TimeSpan Overview | Members

System.TimeSpan.FromHours Method

Returns a TimeSpan that represents the specified number of hours where the specification is accurate to the nearest millisecond.

public static TimeSpan FromHours (double value)

Parameters

value
A double that specifies the number of hours with which the new TimeSpan is initialized.

Returns

A TimeSpan that represents value.

Exceptions

TypeReason
OverflowExceptionThe TimeSpan represented by value is greater than TimeSpan.MaxValue or less than TimeSpan.MinValue.
ArgumentExceptionvalue is equal to double.NaN.

Remarks

value will only be considered accurate to the nearest millisecond.

If value is double.PositiveInfinity, a TimeSpan with the value TimeSpan.MaxValue is returned. If value is double.NegativeInfinity, a TimeSpan with the value TimeSpan.MinValue is returned.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0