Checking for the date after midnight

N

navin

Hi,

In one of my forms, when user saves the data, the form also records
the date the data was saved by the user i have named the field as
transDate.

This is working fine but the problem is since, we work from evening
6:00 PM to morning 3:00 AM, when user saves the data after 12:00 AM,
the transDate field takes the next days date but what i need is that,
even after 12:00 AM, system should calculate and take previous days
date.

Please help. Let me know if my question is not clear.

thanks,
navin
 
K

Ken Sheridan

Navin:

You'll need to use the Now() function rather than the Date() function.
Otherwise those rows inserted into the table before midnight would be
time-stamped at 8.00 PM on the day before. As it’s only the date of entry
you seem to want rather than the date/time its probably also better to
convert the value to one with a zero time of day. Date/time values with
unnecessary non-zero times of day can cause problems when defining date
ranges unless specific action is taken to allow for the non-zero times of
day. So the expression would be:

DateValue(DateAdd("h", -4, Now()))

Otherwise all the values will include

Ken Sheridan
Stafford, England
 
K

Ken Sheridan

Navin:

Seem to have lost a bit in my last post. It should have continued:

Otherwise all the values will include a time of day exactly four hours
before the time of entry.

Ken Sheridan
Stafford, England
 

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