Java tutorial
import java.util.GregorianCalendar; public class Main extends GregorianCalendar { public static void main(String[] args) { // create a new calendar 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 complete() cal.set(GregorianCalendar.YEAR, 1998); cal.complete(); // print the current date System.out.println("New date is : " + cal.getTime()); } }