import java.util.Calendar; public class Main { public static void main(String[] args) { Calendar cal = Calendar.getInstance(); System.out.println("Today : " + cal.getTime()); // Subtract 1 year from the calendar cal.add(Calendar.YEAR, -1); System.out.println("1 year ago: " + cal.getTime()); } }