Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-1827

Document TIMESTAMPADD, TIMESTAMPDIFF functions

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.13.0
    • Component/s: core
    • Labels:
      None

      Description

      Document TIMESTAMPADD, TIMESTAMPDIFF functions.

      (Initial request was to add DATEADD as built-in scalar function, as follows. But it turns out that TIMESTAMPADD is similar enough.)

      Syntax: DATEADD (datepart , number , date )

      Arguments:

      • datepart - Is the part of date to which an integer number is added.
      • number - Is an expression that can be resolved to an int that is added to a datepart of date
      • date - Is an expression that can be resolved to a time.

      Example

      SELECT DATEADD(month, 1, '2017-05-31') from tab;

      returns 2017-06-30 00:00:00.000

      MSSQL: https://docs.microsoft.com/en-us/sql/t-sql/functions/dateadd-transact-sql
      MySql: https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_date-add

        Attachments

          Activity

            People

            • Assignee:
              sunjincheng121 sunjincheng
              Reporter:
              sunjincheng121 sunjincheng
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: