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