Here you can find the source of getYesterday()
public static String getYesterday()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.*; public class Main { public static final String _DEFAULT1 = "yyyy-MM-dd HH:mm"; public static final String _DEFAULT4 = "yyyy-MM-dd"; public static String getYesterday() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); long time = (date.getTime() / 1000) - 60 * 60 * 24; date.setTime(time * 1000);/*w ww . j ava 2 s . com*/ return sdf.format(date); } public static long getTime() { Date dt = new Date(); return dt.getTime(); } public static String format(Date date) { return formatDate(date, _DEFAULT4); } public static String formatDate(Date date) { return formatDate(date, _DEFAULT1); } public static String formatDate(Date date, String style) { return new SimpleDateFormat(style).format(date); } }