How can I get the OADate (OLE Automation date) in javascript? I need to pass my date object (to my web service) in the form of a double value.
in c#:
If you can't modify the web service, you'll have to re-implement ToOADate()
.
MSDN says,
An OLE Automation date is implemented as a floating-point number whose integral component is the number of days before or after midnight, 30 December 1899, and whose fractional component represents the time on that day divided by 24. 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.
Thus, you should be able to write something like
var oaDate = (date - new Date(1899, 11, 31)) / (24 * 60 * 60 * 1000);
(untested)