In message <[EMAIL PROTECTED]>, Timothy Snyder <[EMAIL PROTECTED]> writes
I know you said "don't tell me it's the base date", but the date 1/1/68
was chosen for a reason - it means "divide by 365.25" actually gives the
right answer...

Anybody that relies on that in code is bound to get a nasty surprise.
There are dates for which that doesn't work.  Try it with July 7, 2006.
Today's date is 14437, a year ago was 14072.  The difference is 365.
Divide that by 365.25 and you get less than one year.  The argument could
be made that you could round it after the division, but that will throw
other dates off.  The bottom line is that this is not a safe way to
accurately calculate an age - it's *almost* always right, but when that's
not good enough, it shouldn't be used.

Yes, but that's not quite what I was thinking ...

INT (DAY / 365.25)

will always give the correct number of years since day 0. The other thing I forgot, was MOD( DAY, 7) gives you the day of the week, too, iirc. Any road, day 0 was chosen to make date arithmetic as simple as possible.

Cheers,
Wol
--
Anthony W. Youngman <[EMAIL PROTECTED]>
'Yings, yow graley yin! Suz ae rikt dheu,' said the blue man, taking the
thimble. 'What *is* he?' said Magrat. 'They're gnomes,' said Nanny. The man
lowered the thimble. 'Pictsies!' Carpe Jugulum, Terry Pratchett 1998
Visit the MaVerick web-site - <http://www.maverick-dbms.org> Open Source Pick
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to