skip to Main Content

I have a MySQL table which has a column called “created_at” which is a TIMESTAMP field. Whenever I try to insert datetime bigger than 2037 I get the following error:

#1292 - Incorrect datetime value: '2039-06-18 16:54:35' for column 'created_at' at row 1

I get that this a problem with 32bit MySQL but I am running 64bit shouldn’t that be the solution?

Here is the output of the command for the version of my MySQL:

mysqld  Ver 5.7.26-0ubuntu0.18.04.1 for Linux on x86_64 ((Ubuntu))

Reading this suggesting that using the TIMESTAMP field is the problem and using DATETIME fields will solve it, is that correct?

2

Answers


  1. TIMESTAMP remains UNIX TIMESTAMP (32Bit) for compatibility reasons…

    The suggestion you’ve read is correct, use DATETIME instead.

    Login or Signup to reply.
  2. You should use DATETIME data type.

    The DATE, DATETIME, and TIMESTAMP Types

    The TIMESTAMP data type is used for values that contain both date and time parts. TIMESTAMP has a range of ‘1970-01-01 00:00:01’ UTC to ‘2038-01-19 03:14:07’ UTC.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search