Date.AddYears
Date.AddYears(dateTime as any, numberOfYears as number) as any
Returns the date
, datetime
, or datetimezone
result of adding numberOfYears
to a datetime
value dateTime
.
dateTime
: Thedate
,datetime
, ordatetimezone
value to which years are added.numberOfYears
: The number of years to add.
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)
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)