[MDEV-26736] UNIX_TIMESTAMP doesn't work beyond 2038 (aka y2.038k) Created: 2021-09-30  Updated: 2023-09-18  Resolved: 2021-10-06

Status: Closed
Project: MariaDB Server
Component/s: Temporal Types
Affects Version/s: None
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Scott Baker Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MDEV-32188 make TIMESTAMP use whole 32-bit unsig... In Testing
Relates
relates to MDEV-9444 MariaDB needs to be Y2038-compliant Closed

 Description   

As described in this Reddit post, UNIX_TIMESTAMP does not work for dates beyond 2038. There was also some follow up discussion in another Reddit thread. All my dates are DATETIME fields in the database, and my application expects unixtimes returned from queries. Currently I use UNIX_TIMESTAMP to do this conversion.

SELECT UNIX_TIMESTAMP('2030-02-02 10:10:10'); # Works
SELECT UNIX_TIMESTAMP('2040-02-02 10:10:10'); # Broken

It would be great if UNIX_TIMESTAMP worked with dates beyond 2038, but it sounds like that may not be feasible due to INT32 vs INT64 limitations. If that is the case, then I would suggest a UNIX_TIMESTAMP64 be created to address this limitation.

I have UNIX_TIMESTAMP all over my code, so a simple search/replace to a new version would be simplest.


Generated at Thu Feb 08 09:47:33 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.