[AccessD] Pop-quiz: DateAdd() and negative time values

Jim DeMarco Jdemarco at hshhp.org
Wed Nov 19 18:02:56 CST 2003


A97 gives result "e" from Gustav's original post - 12/30/1899 11:00 PM although we all agree it should return 12/29/1899.

Jim DeMarco

-----Original Message-----
From: Ken Ismert [mailto:KIsmert at TexasSystems.com]
Sent: Wednesday, November 19, 2003 6:03 PM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] Pop-quiz: DateAdd() and negative time values


Lambert, Gustav:

Hmmm... What version of Access are you using? Lambert's routine gives
correct results using Access 2000, SP3. I get 12/29/1899 for the
subtractions > 2 hours, and 12/31 for additions > 23.

-Ken

-----Original Message-----
From: Heenan, Lambert [mailto:Lambert.Heenan at AIG.com]
Sent: Wednesday, November 19, 2003 4:43 PM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] Pop-quiz: DateAdd() and negative time values


Gustav,

Interesting bug you've discovered there, but the moral is not "Be careful
with negative time values", but rather look out for Dec 30 1899 and
"negative additions"

Here's a little code I just run and the output from it...

. . .

Notice that for the magic date 12/30/1899, no matter how many hours you
subtract from a Date/Time item you still wind up with a date of 12/30/1899.
On the other hand if you add hours on everything seems to work as expected.

Lambert

. . .

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


***********************************************************************************
"This electronic message is intended to be for the use only of the named recipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged.  If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited.  If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message.  Thank You".
***********************************************************************************



More information about the AccessD mailing list