1699174476
Last night at 1:54 AM (the first one, by which I mean 1699174476) I updated a DATETIME column with col = NOW(). So did it store 1699174476 in there? It fucking well did not:
SELECT col ... → 2023-11-05 01:54:36
SELECT UNIX_TIMESTAMP(col) ... → 1699178076That’s not 2023-11-05 01:54:36 PDT. that’s 2023-11-05 01:54:36 PST, which is one hour later:
1699167600 = 2023-11-05 00:00:00 PDT
1699171200 = 2023-11-05 01:00:00 PDT
1699174476 = 2023-11-05 01:54:36 PDT ← the first one
1699174740 = 2023-11-05 01:59:00 PDT
1699174800 = 2023-11-05 01:00:00 PST
1699178076 = 2023-11-05 01:54:36 PST ← the second one
1699178400 = 2023-11-05 02:00:00 PSTAlso, your periodic reminder that we are closer to the Y2038 bug than the Y2K bug:
SELECT UNIX_TIMESTAMP("2038-01-18 19:14:07") → 2147483647;
SELECT UNIX_TIMESTAMP("2038-01-18 19:14:08") → NULL;
SELECT VERSION() → 10.5.18-MariaDB-log