How is time calculated?

grenee

Registered User.
Local time
Today, 06:45
Joined
Mar 5, 2012
Messages
212
On a form I want to evaluate if a time entered is later than a schedule time, with a time allowance of 10 minutes added to the schedule time.

here is my code:

if Now() > ScheduleTime + 10 then
msgbox Late

end if

I want to know why is the 10 not recognized and the results are unexpected?
 
In addition to JHB's link - it may help to understand how DateTime values are stored.
Behind the scenes all dates are stored as a decimal number. The integer part refers to Date and the decimal value is the time portion.
Code:
[B]Function                 Displayed date Value           Actual Stored Value[/B]
Now()	                16/06/2016 12:17	         42537.5121890046
Date()	                16/09/2016 00:00	         42629.0000000000
Start of Access Time	01/01/1900 00:00	         1.0000000000

So when you use + 10 you are adding 10 days to your value.
This is why you need to be careful comparing dates that have a time element, but may be displayed just as a date.
e.g. 16/06/2016 12:17 does not equal 16/09/2016 00:00, but it might look like 16/09/2016 should equal 16/09/2016
 
You additional explanations have been very useful
 
Minty

"Start of Access time 01/01/1900 00:00"

Um, to be precise
Start of Access time 01/01/100 00:00

Try
? cdate(-657434)
 
Minty

"Start of Access time 01/01/1900 00:00"

Um, to be precise
Start of Access time 01/01/100 00:00

Try
? cdate(-657434)


Ooh I love a pedant :)
Got spot though , and by definition the

End of Access Time = ? cdate (2958465) = 31/12/9999

By which time I won't care.
 

Users who are viewing this thread

Back
Top Bottom