Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex DataLens
    • Overview
    • Formula syntax
      • All Functions
        • Overview
        • DATEADD
        • DATEPART
        • DATETRUNC
        • DAY
        • DAYOFWEEK
        • HOUR
        • MINUTE
        • MONTH
        • NOW
        • QUARTER
        • SECOND
        • TODAY
        • WEEK
        • YEAR
      • Function Availability
    • Parameters
  • Audit Trails events
  1. Calculated fields
  2. Function reference
  3. Date/Time functions
  4. DATEADD

DATEADD

Written by
Yandex Cloud
Improved by
amatol
Updated at November 6, 2024

SyntaxSyntax

DATEADD( datetime [ , unit [ , number ] ] )

DescriptionDescription

Returns the date obtained by adding unit in the amount of number to the specified date datetime.

The number argument is an integer. It can be negative.
The unit argument takes the following values:

  • "year";
  • "month";
  • "day";
  • "hour";
  • "minute";
  • "second".

Argument types:

  • datetime — Date | Datetime
  • unit — Integer | String
  • number — Integer

Return type: Same type as (datetime)

Note

Only constant values are accepted for the arguments (unit).

Note

For all sources except ClickHouse, number takes only constant values.

ExamplesExamples

DATEADD(#2018-01-12#, "day", 6) = #2018-01-18#
DATEADD(#2018-01-12#, "month", 6) = #2018-07-12#
DATEADD(#2018-01-12#, "year", 6) = #2024-01-12#
DATEADD(#2018-01-12 01:02:03#, "second", 6) = #2018-01-12 01:02:09#
DATEADD(#2018-01-12 01:02:03#, "minute", 6) = #2018-01-12 01:08:03#
DATEADD(#2018-01-12 01:02:03#, "hour", 6) = #2018-01-12 07:02:03#
DATEADD(#2018-01-12 01:02:03#, "day", 6) = #2018-01-18 01:02:03#
DATEADD(#2018-01-12 01:02:03#, "month", 6) = #2018-07-12 01:02:03#
DATEADD(#2018-01-12 01:02:03#, "year", 6) = #2024-01-12 01:02:03#

Data source supportData source support

ClickHouse 21.8, Files, Google Sheets, Yandex Metrica, Microsoft SQL Server 2017 (14.0), MySQL 5.7, Oracle Database 12c (12.1), PostgreSQL 9.3, Yandex Documents, YDB.

Was the article helpful?

Previous
Overview
Next
DATEPART
© 2025 Direct Cursus Technology L.L.C.