rollMonth()

Adds the specified (signed) amount to the Month field, without changing larger fields.

Syntax

Calendar rollMonth(Numeric amount)
  1. amount is the signed amount to add to the Month field.

Usage

When rolling on the Month field, other fields like Day of Month might conflict and need to be changed. For instance, rolling the month on the date 01/31/96 will result in 02/29/96.

For example, to roll the current date up by one month call:
Calendar.fromDate(Date.parseString("08/20/1999","mm/dd/yyyy")).rollMonth(1).toDate().format("mm/dd/yyyy")
This example populates a Word Box. To achieve the same goal and populate a Date box, call:
Calendar.fromDate(Date.parseString("08/20/1999","mm/dd/yyyy")).rollMonth(1).toDate()