Date.AddYears

Date.AddYears

Adds the specified years to the date.

function (optional dateTime as nullable any, numberOfYears as number) as nullable any

Description

Returns the date, datetime, or datetimezone result of adding numberOfYears to a datetime value dateTime.

Category

Date

Examples

Add 4 years to the date, datetime, or datetimezone value representing the date 5/14/2011.

Date.AddYears(#date(2011, 5, 14), 4)

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.

Date.AddYears(#datetime(2011, 5, 14, 8, 15, 22), 10)

datetime(2021, 5, 14, 8, 15, 22)