1

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?

Lakhwinder Singh
  • 5,536
  • 5
  • 27
  • 52
Petar Vasilev
  • 4,281
  • 5
  • 40
  • 74

2 Answers2

4

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

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

Honk der Hase
  • 2,459
  • 1
  • 14
  • 26
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.

Community
  • 1
  • 1
Lukasz Szozda
  • 162,964
  • 23
  • 234
  • 275