Condividi tramite


DateTime.FromOADate Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Returns a DateTime equivalent to the specified OLE Automation date.

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

Syntax

'Declaration
Public Shared Function FromOADate ( _
    d As Double _
) As DateTime
public static DateTime FromOADate(
    double d
)

Parameters

Return Value

Type: System.DateTime
An object that represents the same date and time as the d parameter.

Exceptions

Exception Condition
ArgumentException

The date is not a valid OLE Automation date value.

Remarks

The d parameter is a double-precision floating-point number that represents a date as the number of days before or after the base date, midnight, 30 December 1899. The sign and integral part of d encode the date as a positive or negative day displacement from 30 December 1899, and the absolute value of the fractional part of d encodes the time of day as a fraction of a day displacement from midnight. d must be a value between negative 657435.0 through positive 2958466.0.

Note that because of the way dates are encoded, there are two ways of representing any time of day on 30 December 1899. For example, -0.5 and 0.5 both mean noon on 30 December 1899 because a day displacement of plus or minus zero days from the base date is still the base date, and a half day displacement from midnight is noon.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.