[AccessD] TimeSerial buggy for negative date values

Stuart McLachlan stuart at lexacorp.com.pg
Sun Apr 23 16:25:18 CDT 2006


On 23 Apr 2006 at 16:29, Gustav Brock wrote:

> Hi all
> 
> Did you know that for Access up to and including version 2003 return wrong
> date/time values when the parameters will result in a negative value?

Not wrong values, just values that you are not expecting. It's not a bug, 
it's a feature and it is in fact a feature of all calendars, it's not a 
microsoft thing. 

<quote>
Date variables are stored as IEEE 64-bit (8-byte) floating-point numbers 
that represent dates ranging from 1 January 100 to 31 December 9999 and 
times from 0:00:00 to 23:59:59.
...
Negative whole numbers represent dates before 30 December 1899.
</quote>

You are storing two separate things here, a date and a time - not an offset 
from a zero point.

So:
1.25 represent 6:00am on Day 1
-1.25 represents 6:00am on Day -1
0.25 is meaningless. There is no Day 0.

That is what happens in any calendar system. Think of it using our calendar 
with years as the integer part rather than days.

1 Jan 0001 AD = (Year 1) + 1/365 years
The previous day is:
 31 Dec 0001 BC = (Year -1) + 364/365 days

Key points are:
1. There is no such thing as "0" for the integer part ie  no such as "1 Jan 
0000" or "31 Dec 0000". Using the microsoft representation, there is no 
such thing as "Day 0"  or times within such a day.

2. Fractional parts are always positive, they indicate the amount of the 
specified unit (year or day) that has elapsed.

  


-- 
Stuart





More information about the AccessD mailing list