0

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.

1
  • 1
    Providing the table definition might be useful. Have you tried removing the timezone value?
    – mustaccio
    Commented Sep 27, 2017 at 18:41

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.