essaytee
Need a good one-liner.
- Local time
- Tomorrow, 08:02
- Joined
- Oct 20, 2008
- Messages
- 547
My regional setting for Dates is set to "dd/mm/yyyy". Below are some results from my Immediate Window.
The above shows that the Day, Month & Year are correctly extracted from the inputted date.
The above comparisons correctly return the right results. Not so for the following.
As can be seen, 30 Nov is in fact before (or less than) 1 Dec, and yet the result is wrong. Likewise, switching the dates around also yeilds an incorrect result.
What is the best way to compare dates?
Further, why is the following returning a correct result?
So the above comparison 30 Nov < 1 Dec returns the correct result.
Code:
? Day(#30/11/2018#)
30
? Month(#30/11/2018#)
11
? Year(#30/11/2018#)
2018
Code:
? #30/11/2018# > #29/11/2018#
True
? #1/12/2018# < #2/12/2018#
True
Code:
? #30/11/2018# < #1/12/2018#
False
? #1/12/2018# < #30/11/2018#
True
What is the best way to compare dates?
Further, why is the following returning a correct result?
Code:
? Date()
30/11/2018
? Date()+1
1/12/2018
? Date() < Date()+1
True