How does Access store a date?

J

Jeff Conrad

To quote the legendary MVP John Vinson:

"Access stores Date/Time fields as floating point numbers, counts of
days and fractions of a day (times) since midnight, December 30, 1899.
The format merely controls how the value is displayed, not what's stored."

and

"Because in Access a Date/Time value is NOT A STRING. It's stored
internally as a double floating point count of days from a start
point; it can be formatted in many ways but underneath it's still just
a number."
 
J

Joseph Meehan

I forget the exact format but as I recall it is stored as the year
followed by the day of the year decimal point followed by the time in
seconds. So your example would be something like 2004153.123 for 2minutes
3 seconds after midnight.
 
J

John Vinson

I forget the exact format but as I recall it is stored as the year
followed by the day of the year decimal point followed by the time in
seconds. So your example would be something like 2004153.123 for 2minutes
3 seconds after midnight.

ummm... not actually. It's a running count of days since midnight,
December 30, 1899 in days and fractional days. #06/01/2004 00:02:03#
is, for example:

?cdbl(#06/01/2004 00:02:03#)
38139.0014236111

Or going the other way,

?cdate(38250.6666666666)
9/20/2004 4:00:00 PM


John W. Vinson[MVP]
 
J

Joseph Meehan

John said:
ummm... not actually. It's a running count of days since midnight,
December 30, 1899 in days and fractional days. #06/01/2004 00:02:03#
is, for example:

?cdbl(#06/01/2004 00:02:03#)
38139.0014236111

Or going the other way,

?cdate(38250.6666666666)
9/20/2004 4:00:00 PM


John W. Vinson[MVP]

I knew it was something like that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top