TimeSpan.FromDays Method (Double)
Returns a TimeSpan that represents a specified number of days, where the specification is accurate to the nearest millisecond.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- value
-
Type:
System.Double
A number of days, accurate to the nearest millisecond.
| 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.
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