rollYear()

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

Syntax

Calendar rollYear(Numeric amount)
  1. amount is the signed amount to add to the Year field.

Usage

For example, to roll the current date up by one year call:
Calendar.fromDate(Date.parseString("08/31/1999","mm/dd/yyyy")).rollYear(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/31/1999","mm/dd/yyyy")).rollYear(1).toDate()

When rolling on the Year field, it will roll the year value in the range between 1 and the value returned by calling getMaximumYear().