User Tools

Site Tools


syntax:functions:addyears

AddYears(date, add_years)

Category: Date and Time function


Description

This function adds add_years number of years to date. If add_years is negative, the years are subtracted.


Arguments

ArgumentTypeDescription
dateDate or Number (date serial)A expression representing a date. The date to add years to.
add_years Number The number of years to be added to date, or subtracted if negative.

Return value type: Number (date serial value).


Remarks

The date argument can take any value or expression that evaluates to a date serial value, with or without a time portion. Examples include:

  • A date string: #2019-12-12
  • A date serial value: 43811 (the date serial for "2019-12-12")
  • A date value created using any of the Date/Time functions that returns a date serial value.


Examples

addyears(#2019-12-12, 2)  //Returns 44542 (Equivalent to 2021-Dec-12.)
addyears(43811, 5)  //Returns 45683 (Equivalent to 2024-Dec-12.)
addyears(#2019-12-12, -2)  //Returns 43081 (Equivalent to 2017-Dec-12; subtract years.)


See also

syntax/functions/addyears.txt · Last modified: 2021/08/30 01:54 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki