Here you can find the source of getYesterday()
public static Date getYesterday()
//package com.java2s; /**// ww w . jav a 2s . c o m * Copyright (c)2010-2011 Enterprise Website Content Management System(EWCMS), All rights reserved. * EWCMS PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * http://www.ewcms.com */ import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { private static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd"; public static Date getYesterday() { return getYesterday(DEFAULT_DATE_FORMAT); } public static Date getYesterday(String format) { SimpleDateFormat simple = new SimpleDateFormat(format); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, -1); Date date = calendar.getTime(); try { date = simple.parse(simple.format(date)); } catch (Exception e) { } return date; } }