GregorianCalendar: roll(int field, boolean up)
import java.util.Calendar;
import java.util.GregorianCalendar;
public class Main {
public static void main(String[] a) {
GregorianCalendar calendar = new GregorianCalendar();
calendar.roll(Calendar.MONTH, false); // Go back a month
System.out.println(calendar.get(Calendar.MONTH));
}
}
Related examples in the same category