Here you can find the source of getYesterday()
public static Date getYesterday()
//package com.java2s; import java.util.Date; public class Main { public static Date getYesterday() { Date today = getToday();//from www . j a v a2 s .co m Date yesterday = new Date(today.getYear(), today.getMonth(), today.getDate() - 1); //beginning of yesterday return yesterday; } public static Date getToday() { Date now = new Date(); Date today = new Date(now.getYear(), now.getMonth(), now.getDate()); //beginning of today return today; } }