Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does the 31st of Feb really exist

Status
Not open for further replies.

ProgramError

Programmer
Mar 2, 2005
1,027
GB
Access thinks 31st of feb is a true date.

I used the following in the immediate window in VBA and it returned as being true???

Try it in the immediate window
? isdate("31/02/08")
? isdate("99/02/08")

It also works with 99th of June and other dates up to
? isdate("12/13/08")

? isdate("13/13/08") returns false

Ian Mayor (UK)
Program Error
Always make your words sweet and nice. Because you never know when you may have to eat them.
 
What you have is 1931

? year(#31/02/08#)
1931
 
I suppose I should add:

[tt]IsDate returns True if the expression is a date or is recognizable as a valid date; otherwise, it returns False. In Microsoft Windows, the range of valid dates is January 1, 100 A.D. through December 31, 9999 A.D.; the ranges vary among operating systems.[/tt]

-- Microsoft Help

The dates that you show are not unambigous:

?isdate("31/02/2008")
False
 
If you run the check with the ANSI date format yyyy-mm-dd it returns false.

ANSI date format is the safest for any date based storage in databases, regardless of the platform as it is unambiguously interpreted, not subject to how your country code is set in your operating system.

? isdate ("2008-02-31")

returns false

? isdate (#2008-02-31#)

I get an Expected:expression error.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top