Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-26736

UNIX_TIMESTAMP doesn't work beyond 2038 (aka y2.038k)

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • None
    • N/A
    • Temporal Types
    • None

    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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              scottchiefbaker Scott Baker
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.