Categories
datetime macos mysql php

MySQL error – Invalid datetime format: 1292 Incorrect datetime value: ” for column

I am using mysql in Os X 10.9.2 and when I try to run my php website in local I have this error:

Invalid datetime format: 1292 Incorrect datetime value: ” for column nameOfTheColumn

The Error happens when I tried to insert an empty value in a datetime field. The site works fine in production and in some other locals computers, so the problem is in database and I have to be solve in my local database. Reading about the problem I read that mysql could be running in Strict mode, so I edit /usr/local/mysql/my.cnf and I comment out this line:

 #sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

I restart computer and still is not working, but according to the documentation online and others questions, this is the way, but I would like to know What is it the exactly change I have to do to make my application works. Repeat, the code works in production, windows with xampp, etc… so can not be change because is to long and just for work in local I need the right change in MYSQL DATABASE.

Thanks in advance!