How do I convert a DateTime
value to a double
?
views:
280answers:
2
+5
A:
If, by double
you mean an OLE Automation date, then you can use DateTime.ToOADate()
. From the linked MSDN topic:
An OLE Automation date is implemented as a floating-point number whose value is the number of days from midnight, 30 December 1899. For example, midnight, 31 December 1899 is represented by 1.0; 6 A.M., 1 January 1900 is represented by 2.25; midnight, 29 December 1899 is represented by -1.0; and 6 A.M., 29 December 1899 is represented by -1.25.
The base OLE Automation Date is midnight, 30 December 1899. The maximum OLE Automation Date is the same as MaxValue, the last moment of 31 December 9999.
If you're talking about some other date representation that can also be stored in a double
, please specify...
Shog9
2009-06-18 03:53:44
you beat me to it
jle
2009-06-18 03:54:49
*blows smoke off finger tips*
Shog9
2009-06-18 03:55:42