Re: COleDateTime base date 30 Dec 1899. Why??
On Thu, 22 May 2008 20:59:10 +0200, Colin Peters <cpeters@coldmail.com>
wrote:
That makes sense. So the base date for Excel was 31 Dec 1899, 00:00
a.m.? I wonder why the base date for SQL server is a day later....copied
from Oracle?
Who knows? I always liked the way Plauger concluded Chapter 15 in "The
Standard C Library":
Exercise 15.9 [Very hard] Devise a more orderly way to measure time. Get
somebody with some authority to agree to adopt it.
Seems like this was done multiple times, for many definitions of "orderly".
All kidding aside, all these methods are basically the same, and after
implementing the library time functions, I think he was wishing for a
system that did away with leap years, leap seconds, time zones, and
everything else that makes time programming so much fun.
BTW the original problem revolved around using the Filter property of an
ADO recordset, and that the Filter date format isn't directly compatible
with the SQL date format. My solution of comparing the dates cast as
doubles (with the 2 day offset) had a little potential bugette. Namely
that the Filter is a string whci I composed using the CString::Format
method. This also uses local convention, so rather than getting
"DateReal >= 32590.234 and DateReal <= 32595.123" I got "DateReal >=
32.590,234 and DateReal <= 32.595,123" on a German OS. Which ADO won't
parse correctly, IMHO. So it seems that ADO filter dates ought to be in
local format, but other numbers not.
Thanks for your time Doug, that little conumdrum was going round my head
for ages.
No problemo.
--
Doug Harrison
Visual C++ MVP