On Thu, 17 Jan 2008, [EMAIL PROTECTED] wrote:

"Virgilio Fornazin" <[EMAIL PROTECTED]> wrote:
DATEDIFF should compute the difference by arithmetic subtracting M/Y in
month case, if I'm not wrong

ex:

DateDiff (month, 1-1-2007, 3-30-2007) will return 2

Its that right ?

So datediff('month', '2008-02-01 23:59:59','2008-01-31 00:00:00') should
return 1 even though the difference is really only 1 second?  Seems
goofy to me....

--
D. Richard Hipp <[EMAIL PROTECTED]>

The timestamp is a very useful thing, but IMHO, dates are dates, and times are times. Date arithmentic is very easy given a true Julian date, calculated as the number of *DAYS* since an "epoch" (Oct 15, 1583?), and times can be the number of seconds, tenths of seconds, milliseconds or whatever in a day, but stored as separate variables.

There is much subjective processing in time differences when you start adding +- n months, and much of it can be avoided by not using the system type timestamps to store dates, and keeping a date variable and time variable (both integers).

I wrote a Tcl binding for a Julian date and time library I've used for years, and made it available, both as C library (BSD/Linux/Windows), and Tcl Extension (BSD/Windows). There is a unix style man page for documentation.

        http://www.controlq.com/OpenSource/Tcl_Julian.tgz

HTH,
Rob Sciuk



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to