BigBadBarnes
asked on
CDate() function
Does anyone know why CDate(05/08/0001) is returning me 05/08/2001...And the IsDate function returns this as a valid date as well...I need a function that will return false, because this is not a valid date, or at least I dont think it is....
To answer your second question, 05/08/0001 is a valid date: May eighth in the year one.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What format of date are you using ? American or european layout ? (so mm/dd/yyyy or dd/mm/yyyy)
For example:
'if 2/12/99 is 2nd December or 12th Febuary if you don't know which system your machine is using
It will return both valid.
Suppose you have on your system the american format, then 12/13/2004 will be valid, but 13/12/2004 will be invalid (while you can suppose that it's the other way).
You can also format your date and then validate it with isDate
Here you can find a function to see if a date string is valid using regional date settings
http://www.vb-helper.com/howto_validate_date_international.html
For example:
'if 2/12/99 is 2nd December or 12th Febuary if you don't know which system your machine is using
It will return both valid.
Suppose you have on your system the american format, then 12/13/2004 will be valid, but 13/12/2004 will be invalid (while you can suppose that it's the other way).
You can also format your date and then validate it with isDate
Here you can find a function to see if a date string is valid using regional date settings
http://www.vb-helper.com/howto_validate_date_international.html