NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DateTime.ToOADate

Converts the DateTime instance into an OLE Automation compatible date.

[Visual Basic]
Public Function ToOADate() As Double
[C#]
public double ToOADate();
[C++]
public: double ToOADate();
[JScript]
public function ToOADate() : double;

Return Value

A Double value that represents the OLE Automation compatible date.

Exceptions

Exception Type Condition
OverflowException If the value of this instance cannot be represented as an OLE Automation Date.

Remarks

In order for an un-initialized DateTime (one with a ticks value of 0) to be equivalent to an un-initialized OLE Automation Date (one with a double value of 0.0), a DateTime with a tick value of 0 is converted to 0.0, the OLE Automation Date value of midnight, 30 December 1899.

Only DateTime objects with a tick value that is greater than or equal to positive or negative 31241376000000000 can be represented as an OLE Automation Date. There is an exception.

Note   The Ticks value of a DateTime is between MinValue and MaxValue.
Note   The maximum value of a DateTime is equal to the maximum value of an OLE Automation Date.

See FromOADate and System.OAVariantLib class, or a MSDN Online Libary search at http://MSDN.com/library/default.asp for more information on OLE Automation.

See Also

DateTime Structure | DateTime Members | System Namespace | Double | System.OAVaiantLib | FromOADate