Java tutorial
import java.util.*; public class Main { public static void main(String[] args) { GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance(); // add 2 months cal.add((GregorianCalendar.MONTH), 2); // print the modified date and time System.out.println(cal.getTime()); // add 2 years cal.add((GregorianCalendar.YEAR), 2); // print the modified date and time System.out.println(cal.getTime()); } }