Skip to content

AddYears

Adds a specified number of years to a DateTimeOffset value and returns the result.

1
myCalendar.AddYears(dateTime: [DateTimeOffset](./../DateTimeOffset/index.md), years: number):DateTimeOffset

Parameters

DateTimeOffset dateTime
    The base DateTimeOffset value.

number years
    The number of years to add.

Returns

A new DateTimeOffset value with the added years.

Remarks

Add calendar years to the current date

1
var newDate = $Calendar.AddYears($Calendar.Today, 3); //adds 3 years to the current date and returns DateTimeOffset object.

See Also