Link to home
Start Free TrialLog in
Avatar of andw928
andw928

asked on

System.InvalidCastException: Cast from string "11/18/2003" to type 'Date' is not valid.

Why can't I format this: CDate("11/18/2003") in asp.net
Do I have a culture set up somewhere different then un-us?
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

What are you trying to store this into?  If it something like this:

stringvalue = CDate("11/18/2003"), where stringvalue is a string variable, then you will get the error.
ASKER CERTIFIED SOLUTION
Avatar of the-edge
the-edge

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dc197
dc197

ALWAYS use dates in the UNambigous format yyyy-mm-dd which is the ODBC format.
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: the-edge {http:#9814417}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TheLearnedOne
EE Cleanup Volunteer