Skip to main content



AddYears Function

The AddYears function adds a specified number of years to a DateTime value.

Syntax​

AddYears(dateTime, numYears)

The AddYears function adds a specified number of years to a DateTime value.

Arguments​

dateTime DateTime - The base date and time.

numYears Integer - The number of years to add. A negative value will subtract years.

Remarks​

Example:

AddYears("5/1/2000",2); // returns 5/1/2002

Example:

AddYears("5/1/2000",-2); // returns 5/1/1999