Timestamp, year 2038 problem for 64 bit Ubuntu system

Well if there's an option to literally buy a "bit", ie transfer from a signed 32bit integer to an unsigned 32bit integer, things keep working into 2106.

Transferring to 64bit is "somewhat better". You get hundreds billions of years of resolution.

And Ubuntu does this:

$ uname -p
x86_64

$ date --date=9090-01-01 +%s
224685532800

However, that's the OS level. Just because Ubuntu uses a 64bit integer for its times doesn't mean that MySQL/MariaDB will use it to store its timestamps. If dates past 2038 are important to your now, start testing immediately.

Actually, I can save you some time. It's still broken. This bug was reported over a decade ago but its main test still fails with a 64bit int.

mysql> select from_unixtime(2548990800);
+---------------------------+
| from_unixtime(2548990800) |
+---------------------------+
| NULL                      |
+---------------------------+
1 row in set (0.00 sec)

This isn't even storage. It's slightly pathetic.

(And yes, that was run on MariaDB, version 10.1)


Don't store it as an integer at all. Store it as an ISO 8601 formatted date string. This is the standard format used across the Internet.

9999-12-31T23:59:59+00:00