Incorrect datetime value on TIMESTAMP column

1.5k Views Asked by At

I have a mysql (version 5.6.24) with a table where one of the columns updated_at is a TIMESTAMP default CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP.

I never needed to worry about this column as it updates itself like expected when directly editing the database.

I recently moved my app to a new server and a error starting happening on my php script:

Fatal error: Uncaught exception 'ActiveRecord\DatabaseException' with message '22007, 1292, 
Incorrect datetime value: '2015-06-10 22:15:03 UTC' for column 'updated_at' at row 1' 

I'm using PHP ActiveRecord, and this is where the error takes place:

$user->name = $userData->name;
$user->avatar = $userData->avatar;
$user->save();

Just to make sure, I tried to add in the script (before save()):

$user->updated_at = "2015-06-10 22:15:03";

and then:

$user->updated_at = date("Y-m-d H:i:s");

The error persisted. How can I solve this?

0

There are 0 best solutions below