Recent Posts
- (09/10) Fixing Warning: the ECDSA host key for 'github.com' differs from the key for the IP addressTAGS:Web Server Admin
- (12/26) CakePHP 3 - Getting List of Column Definitions from a Table (like schema())TAGS:CakephpCake3
- (09/14) Change Order of Loaded Behaviors in CakePHP 3TAGS:Cake3CakephpWeb ProgrammingPhp
- (05/29) CakePHP 3 - Accept JSON Header Only Working When Debug FalseTAGS:Web ProgrammingCakephpCake3
- (05/23) Remove All Events from Google Calendar (Reset Calendar)TAGS:Web ProgrammingPhp
- (11/08) Google Tag Manager (GTM) Not Firing Default PageView EventTAGS:Web ProgrammingJavascriptGoogle Tag Manager
- (10/13) In PHP, how do you get __toString() Magic Method Result without calling echo?TAGS:CakephpCake3Cakephp 13PhpWeb Programming
- (11/14) Getting output from shell_exec() at all timesTAGS:Web ProgrammingWeb Server Admin
Subscribe to my feed
MainelyDesign.com Blog
Invalid Date Value Error in MySQL
Posted on 09/09/2009 at 02:26 pm by Kevin Wentworth
Viewed 12,824 times | 0 comments
I ran into an interesting issue with valid dates and MySQL on Windows. I wrote a CakePHP import function that basically moves MySQL data from one DB to the other. I never thought that I would see an error related to an invalid date, but I did.
What determines if a date value is invalid (read: warning) or unacceptable (read: error)?
It turns out to be based on the sql_mode you have specified for your MySQL server. I found this extremely thorough description of the different MySQL sql_mode options here.
In my case it was an invalid leap year date.
This is the MySQL error I got: 1292 - Incorrect date value: '2007-02-29' for column 'event_start_date' at row 1.
Damn leap years!
The database servers have different sql_mode settings, which allowed the invalid date to be inserted on one, but not the other MySQL server.
Cheers,
-Kevin
Tags for Invalid Date Value Error in MySQL
Mysql | Database | Import | Php | Web Programming | Cakephp | Web Server Admin | Windows
Comments for this Posting
No comments. Be the first to post a reply.
Sorry, comments are closed for this posting.
Please Email Kevin if you have any questions. Thanks!