Java tutorial
import java.util.GregorianCalendar; public class Main extends GregorianCalendar { public static void main(String[] args) { Main cal = new Main(); // print the current date System.out.println("The current date is : " + cal.getTime()); // clear the calendar cal.clear(); // set a new year and call computeTime() cal.set(GregorianCalendar.YEAR, 2013); cal.computeTime(); // print the current date System.out.println("New date is : " + cal.getTime()); } }