[thelist] MySQL Convert String To Date

Jason Handby jasonh at corestar.co.uk
Wed Jul 23 07:59:35 CDT 2003

Chris Marsh wrote:
> I have inherited the database. Unfortunately because the date field is
> of type varchar, there exist some incorrect dates, so I need to clean up
> the data.

You may find that MySQL is tolerant enough of illegal dates in DATETIME
fields for your purposes:


'The MySQL server only performs basic checking on the validity of a date:
days 00-31, months 00-12, years 1000-9999. Any date not within this range
will revert to 0000-00-00. Please note that this still allows you to store
invalid dates such as 2002-04-31. It allows web applications to store data
from a form without further checking. To ensure a date is valid, perform a
check in your application.'


More information about the thelist mailing list