Date Change at 9 AM instead of midnight

WackyWaterGuy

Registered User.
Local time
Today, 05:36
Joined
May 29, 2003
Messages
25
Hey Everyone

Hope you all are doing well. Just a quick - and hopefully simple - little question that I hope someone can help me out with.

I have a form, and on this form is a textbox which displays the date (its default value is set to =date() ). As such, when midnight rolls around, the date changes to the next day. I was wondering if it is possible to have the date change at 9 AM instead. (For example at 2:30 AM on May 25th, the date would still show May 24th. Then at 9:00AM May 25th, it would show May 25th.)

I am sure there has got to be a way to do this...but unfortunately it goes beyond my scope! Can one of you smart people help me out??

I would really appreciate it!

Thanks
WWG!
 
Set the default value to:
=IIf(Time()>#9:00:00 AM#,Date(),DateAdd("d",-1,Date()))
 
for adding and substracting days you dont need dateadd you can simply say date() -1

for substracting hours devide the hours by 24, actually you want the date of 9 hours ago... so:

now() -9/24

But this will result in a date/time field: 12-08-2003 23:18:13, if you want to go back to a "normal" or "real" date use:

int(now()-9/24)
or
cdate(int(now()-9/24))
or use format

Regards

PS i HATE dateadd for these things (its good for adding months and such tho !)
 

Users who are viewing this thread

Back
Top Bottom