System.TimeSpan.FromMinutes Method

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

Syntax

public static TimeSpan FromMinutes (double value)

Parameters

value
A number of minutes, accurate to the nearest millisecond.

Returns

An object that represents value.

Exceptions

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

Remarks

The value parameter is converted to milliseconds, which is converted to ticks, and that number of ticks is used to initialize the new TimeSpan. Therefore, value will only be considered accurate to the nearest millisecond. Note that, because of the loss of precision of the double data type, this conversion can generate an OverflowException for values that are near to but still in the range of either TimeSpan.MinValue or TimeSpan.MaxValue. For example, this causes an OverflowException in the following attempt to instantiate a TimeSpan object.

code reference: System.TimeSpan.FromMinutes#1

Requirements

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