Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static Date getYesterday(Date from) { Calendar c = buildFromDate(from); c.add(Calendar.DATE, -1); // number of days to add return c.getTime(); } private static Calendar buildFromDate(Date from) { Calendar c = Calendar.getInstance(); c.setTime(from); return c; } }