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

Gustav Brock gustav at cactus.dk
Wed Nov 19 11:40:02 CST 2003


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



More information about the AccessD mailing list