Here you can find the source of getPreviousDay(Date dateTime)
public static Date getPreviousDay(Date dateTime)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static Date getPreviousDay(Date dateTime) { return addDay(dateTime, -1); }/* www. j av a 2 s . co m*/ public static Date addDay(Date dateTime, int days) { Calendar cal = Calendar.getInstance(); cal.setTime(dateTime); cal.add(Calendar.DAY_OF_MONTH, days); return cal.getTime(); } }