Calculate date based off of system time

S

Sam

Hello,

I'm trying to calculate my field (currently =Date()+1) to change a date
field on the form based off of what the current system time is.

For example, if the current time is greater than 15:00, then I need it to
show tomorrow's date. Otherwise, show the date today.

To go even more in depth, it would be great to say if the date is Friday and
it is after 11:00, show Monday's date.
 
P

Piet Linden

Hello,

I'm trying to calculate my field (currently =Date()+1) to change a date
field on the form based off of what the current system time is.

For example, if the current time is greater than 15:00, then I need it to
show tomorrow's date. Otherwise, show the date today.

To go even more in depth, it would be great to say if the date is Friday and
it is after 11:00, show Monday's date.

use Time()
?Time()>#15:00#
False
 
P

Piet Linden

Hello,

I'm trying to calculate my field (currently =Date()+1) to change a date
field on the form based off of what the current system time is.

For example, if the current time is greater than 15:00, then I need it to
show tomorrow's date. Otherwise, show the date today.

To go even more in depth, it would be great to say if the date is Friday and
it is after 11:00, show Monday's date.

oh, missed a piece
?weekday(date())
6 (or vbFriday)
 
K

KARL DEWEY

Try this --

IIf(Weekday(Date())=4,Date()+3,IIf(Val(TimeValue(Now()))>=15,Date()+1,Date()))

I am sure there are simpler ways than Val(TimeValue(Now()))>=15 but this
works.
 
J

John W. Vinson

Try this --

IIf(Weekday(Date())=4,Date()+3,IIf(Val(TimeValue(Now()))>=15,Date()+1,Date()))

I am sure there are simpler ways than Val(TimeValue(Now()))>=15 but this
works.

Hour(Time()) >= 15 or Hour(Now()) >= 15 or just

Time() >= #15:00#
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top