Skip to main content

Celonis Product Documentation

ADD_YEARS
Description

ADD_YEARS adds a given number of years to a given date.

Supported input column types: base_column -> DATE, years_column -> INT

Output column type: DATE

If the input date is last day of the month, the resulting date will be last day of the month.

If a result of type DATE is outside the interval from the year 1400 CE (including) to the year 10000 CE (excluding), it will be mapped to NULL.

Syntax
  ADD_YEARS ( table.base_column, table.years_column )
 
NULL handling

If any parameter is NULL, the result is NULL as well.

Example

[1]

Simple example for ADD_YEARS.

Query

Column1

         ADD_YEARS ( "Table1"."Base_Column" , "Table1"."Year_Column" )
        

Input

Output

Table1

Base_Column : date

Year_Column : int

Mon Jan 01 2018 00:00:00.000

1

Mon Jan 01 2018 00:00:00.000

0

Mon Jan 01 2018 00:00:00.000

-1

Result

Column1 : date

Tue Jan 01 2019 00:00:00.000

Mon Jan 01 2018 00:00:00.000

Sun Jan 01 2017 00:00:00.000

[2]

Leap years behaviour with ADD_YEARS.

Query

Column1

         ADD_YEARS ( "Table1"."DateColumn" , "Table1"."Integer" )
        

Input

Output

Table1

DateColumn : date

Integer : int

Wed Feb 28 2018 00:00:00.000

2

Sat Feb 29 2020 00:00:00.000

2

Sat Feb 29 2020 00:00:00.000

4

Sat Feb 29 2020 00:00:00.000

11

Result

Column1 : date

Sat Feb 29 2020 00:00:00.000

Mon Feb 28 2022 00:00:00.000

Thu Feb 29 2024 00:00:00.000

Fri Feb 28 2031 00:00:00.000