Adds years to a datetime.
A new datetime.
|Datetime||A datetime in OI internal format. (REQUIRED)|
|Years||The number of years to add. (REQUIRED)|
The "AddYears" service calculates a new datetime by adding the given number of years to an existing datetime. You can pass whole numbers or decimal numbers. You can also pass negative values to subtract years.
This service does not simply add years in chunks of 365. It adds whole years without modifying the month, day, and time of day if possible. January 30, 2020 falls on a leap year, but adding 1 whole year still gets you January 30, 2021. If adding a whole year would make the date invalid, the date will be adjusted. Adding 1 whole year to February 29, 2020 will get you February 28, 2021. Fractions of a year are calculated using the average year length, which is 365.25.