Here you can find the source of getPreviousDay(Date inputDate)
public static Date getPreviousDay(Date inputDate)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static Date getPreviousDay() { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_MONTH, -1); return calendar.getTime(); }/* w w w.j a va 2 s. c om*/ public static Date getPreviousDay(Date inputDate) { Calendar calendar = getCalendar(inputDate); calendar.add(Calendar.DAY_OF_MONTH, -1); return calendar.getTime(); } public static Calendar getCalendar(Date inputDate) { if (inputDate == null) return null; Calendar calendar = Calendar.getInstance(); calendar.setTime(inputDate); return calendar; } }