Just to add another method to the mix \:\) The TDateTime class in Delphi (Pascal) uses a float for dates and times counting from midnight on the 30th of December 1899 as 0.0.

The whole number is the number of days since that date and the fractional component is the time since midnight. so .25 is 0600 and .5 is noon etc.

As I type this, it's 01/05/2008 17:37:03 which is 39569.7340687384. This is a cool system as you get as much accuracy as the computer can count. Typically you would format it down to milliseconds at the most.

Getting the difference in dates is just one number minus the other with or without the fractions if you care for the times. I was born at 26961.3958395718, so I am now 12608.3382291666 days old.

In fact, here's a little app to show those numbers in action...

cj


Edited by cj (2008-05-01 10:17 AM)
Edit Reason: Added URL to app