MySQL timestamp datatype will have issues in 2038
May 16, 2020    |    MySQL

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.

https://dev.mysql.com/doc/refman/8.0/en/datetime.html

If you are using MySQL timestamps beware. In about 18 years from the time if this post you will have issues.

The MySQL timestamp field does not allow date ranges greater than 2038-01-19. This means that when you select a timestamp, the result will be zero. To illustrate this problem, run the following query on your MySQL server.

SELECT UNIX_TIMESTAMP('2038-01-20');

The result of this query is 0.

For more information on the fun world of MySQL timestamps I recommend the following Stackoverflow post:

https://stackoverflow.com/questions/19023978/should-mysql-have-its-timezone-set-to-utc

Leave a Reply

Your email address will not be published. Required fields are marked *