Full Version: Now() > #12:30:00 PM# = true? (It's 10 AM here...)
UtterAccess Forums > Microsoft® Access > Access Date + Time
MrSiezen
Why is this comparison true at 10 AM?
ow() > #12:30:00 PM#
Larry Larsen
Hi
Try:
TimeValue(Now()) > #12:30:00 PM#
Result:
False
thumbup.gif
MrSiezen
Ah thanks!
Larry Larsen
thumbup.gif
truittb
To explain why it is that way you need to understand that Access uses a default value for every date/time datatype. If you do not supply either the date or the time Access uses 0 for the missing portion. In your case the date is Dec 30, 1899.
Try this in the iommediate window, it converts the time value to a datetime and then returns the year.
? year(cdate(#12:30:00 PM#))
1899
You could also use the Time() function
? Time() > #12:30:00 PM#
False
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.