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

Document TIMESTAMPADD, TIMESTAMPDIFF functions

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.13.0
    • core
    • 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

            sunjincheng121 sunjincheng
            sunjincheng121 sunjincheng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: