Mysql – Incorrect datetime value

datetimeMySQL

I am trying to fill my table with data but I am having trouble with the datetimes (Incorrect datetime value error). My data is in this format 2017-08-30 10:00:00-07:00.

What kind of transformation is needed so that I can insert the right time in my database?

Here's an example which is not working. I am using MySQL 5.6.10

INSERT INTO table (id, created_at)  
VALUES (89208460, "2017-08-30 10:00:00-07:00"); 

Running SELECT NOW() gives me 2017-09-27 11:47:38, it's a DATETIME(19) field.

Best Answer

Community wiki answer:

Running SELECT NOW() gives me 2017-09-27 11:47:38, it's a DATETIME(19) field.

Not (19), the number is the number of decimal places in the seconds.

What kind of transformation is needed so that I can insert the right time in my database?

MySQL has no concept of time zone representation.

That is there is no way to use (read or write) -07:00.