Add the specified number of years to this date.
Syntax
public DtpDate addYears(int numberOfYears)
Parameters
Return values
A new DtpDate object.
Notes
The addYears() method adds the specified number of years to this date. You can then use the get() methods to retrieve the information of the resulting new date. The DtpDate returned inherits all the properties of the current instance of DtpDate, such as month names, date format, and so on.
Examples
DtpDate toDay = new DtpDate(); DtpDate lastYear= toDay.addYears(-1); System.out.println("Next month is " + lastYear.getDayOfMonth() + "/" + lastYear.getNumericMonth() + "/" + lastYear.getYear() + " " + lastYear.getHours() + ":" + lastYear.getMinutes() + ":" + lastYear.getSeconds());
See also