TimeSpan.FromDays Method (Double)

 

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

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

static member FromDays : 
        value:float -> TimeSpan

Parameters

value
Type: System.Double

A number of days, accurate to the nearest millisecond.

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 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 cause 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 using the FromDays 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: