GlideDateTime - addMonthsLocalTime(Number months)

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

The method determines the local date and time equivalent to the value stored by the GlideDateTime object, then adds or subtracts months using the local date and time values.

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

Scoped equivalent

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

var gdt = new GlideDateTime("2011-08-31 08:00:00");
gdt.addMonthsLocalTime(2);
gs.print(gdt.getDate());

Output: 2011-10-31