GlideDateTime - addYearsUTC(Number years)

Adds a specified number of years to the current GlideDateTime object. A negative parameter subtracts years.

The date and time value stored by GlideDateTime object is interpreted as being in the UTC time zone.

Table 1. Parameters
Name Type Description
years Number The number of years to add. Use a negative value to subtract.
Table 2. Returns
Type Description
void

Scoped equivalent

To use the addYearsUTC() method in a scoped application, use the corresponding scoped method: Scoped GlideDateTime - addYearsUTC(Number years).

var gdt = new GlideDateTime("2010-08-31 08:00:00");
gdt.addYearsUTC(1);
gs.print(gdt.getDate());

Output: 2011-08-31