Here you can find the source of getTheDayBefore(Date date)
public static Date getTheDayBefore(Date date)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.*; public class Main { private final static SimpleDateFormat sdfTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static Date getTheDayBefore(Date date) { return new Date(date.getTime() - (long) 24 * (long) 60 * 60 * 1000); }//from ww w .j a va2 s . c o m public static String getTime() { return sdfTime.format(new Date()); } }