Can anyone give me a convincing explanation why this returns True in both cases?
Debug.Print IsDate("59/12/08")
Debug.Print IsDate("39/11/06")
Printable View
Can anyone give me a convincing explanation why this returns True in both cases?
Debug.Print IsDate("59/12/08")
Debug.Print IsDate("39/11/06")
I know why; it guesses at the year!:ehh:
According to MS:
Function IsDate(Expression) As Boolean
Member of VBA.Information
Returns True if an expression can be converted to a date
It's daft because it guesses at the format.
I want to pass it a string I know to be in the format DD/MM/YY
so, 59/12/08 is obviously not a valid date.
Nevermind, I'll knock something up myself...
All dates are going to be in this centaury so Ill just prepend "20" to the year field
But, it is a valid date format and, as gavio has intimated, that is all IsDate will confirm (or deny).Quote:
Originally Posted by Guru
Type this in some sub in VB:
and move the cursor off the "d =" line. That's why 59/12/08 is a valid date.Code:Dim d As Date
d = #59/12/08#