Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Syntax
Date.AddYears(dateTime as any, numberOfYears as number) as any
About
Returns the date, datetime, or datetimezone result of adding numberOfYears to a datetime value dateTime.
dateTime: Thedate,datetime, ordatetimezonevalue to which years are added.numberOfYears: The number of years to add.
Example 1
Add 4 years to the date, datetime, or datetimezone value representing the date 5/14/2011.
Usage
Date.AddYears(#date(2011, 5, 14), 4)
Output
#date(2015, 5, 14)
Example 2
Add 10 years to the date, datetime, or datetimezone value representing the date and time of 5/14/2011 08:15:22 AM.
Usage
Date.AddYears(#datetime(2011, 5, 14, 8, 15, 22), 10)
Output
#datetime(2021, 5, 14, 8, 15, 22)