Elizabeth Carter
Elizabeth.Carter at telus.com
Wed Nov 19 12:30:23 CST 2003
The answer you got is the one I would have expected off the top of my head... but it wasn't an option in the answers.
Liz
-----Original Message-----
From: jeffrey.demulling at usbank.com [mailto:jeffrey.demulling at usbank.com]
Sent: November 19, 2003 10:11 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Pop-quiz: DateAdd() and negative time values
I thought it would be either a or d. But when I ran it I got 12/29/1899
11:00 PM.
I used the following:
Function test()
MsgBox Format(DateAdd("h", -3, #2:00:00 AM#), "mm\/dd\/yyyy hh\:nn AM/PM")
End Function
"Gustav Brock"
<gustav at cactus.dk> To: "Access Developers discussion and problem solving"
Sent by: <accessd at databaseadvisors.com>
accessd-bounces at databasead cc:
visors.com Subject: [AccessD] Pop-quiz: DateAdd() and negative time values
11/19/2003 11:40 AM
Please respond to "Access
Developers discussion and
problem solving"
Boring day.
So here's a quick quiz to wake you up.
The time value of #02:00 AM# equals
12/30/1899 02:00 AM
What does - off your head - this expression return:
? Format(DateAdd("h", -3, #02:00 AM#),"mm\/dd\/yyyy hh\:nn AM/PM")
a) 12/30/1898 11:00 PM
b) 12/30/1899 01:00 AM
c) 12/30/1899 05:00 AM
d) 12/30/1899 05:00 PM
e) 12/30/1899 11:00 PM
The tricky part is DateAdd(). Format(), it is only for ensuring a
consistent format of the return value.
Morale: Be careful with negative time values.
/gustav
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com