Recent Posts
- (02/24) Calling an Element from a Helper TAGS:CakephpWeb ProgrammingUsageTutorialExample
- (10/14) Forcing A Single Join in CakePHP PaginationTAGS:CakephpCakephp 13DatabaseErrorsHabtmMysqlMssqlWeb ProgrammingUsage
- (08/11) Inserting NOW() into MySQL Using CakePHPTAGS:CakephpDatabaseMysqlMssqlWeb ProgrammingUsage
- (08/07) Best PaginateCount for CakePHP - with Group By SupportTAGS:CakephpBehaviorsWeb ProgrammingUsageDatabaseExampleMysqlHabtmHack
- (04/03) CakePHP Error Messages Not Showing on FormTAGS:CakephpCakephp 13Web ProgrammingErrorsUsage
- (02/06) Sorting Paginated Results Using a Related Model Field in CakePHPTAGS:CakephpWeb ProgrammingUsageExample
- (11/02) Changing CakePHP's Model useTable on the FlyTAGS:CakephpWeb ProgrammingMysqlDatabaseExampleTutorial
- (10/18) The Funniest Error Message Ever - Thank You EclipseTAGS:EclipseWeb ProgrammingErrorsHumorWindowsUsageSoftwarePhpCakephp
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 1,878 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!
