TimeSpan.FromMilliseconds Method (Double)

 

Returns a TimeSpan that represents a specified number of milliseconds.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

static member FromMilliseconds : 
        value:float -> TimeSpan

Parameters

value
Type: System.Double

A number of milliseconds.

Return Value

Type: System.TimeSpan

An object that represents value.

Exception Condition
OverflowException

value is less than MinValue or greater than MaxValue.

-or-

value is Double.PositiveInfinity.

-or-

value is Double.NegativeInfinity.

ArgumentException

value is equal to Double.NaN.

The value parameter 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 MinValue or MaxValue. For example, this causes an OverflowException in the following attempt to instantiate a TimeSpan object.

No code example is currently available or this language may not be supported.

The following example creates several TimeSpan objects by using the FromMilliseconds method.

No code example is currently available or this language may not be supported.

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: