Here you can find the source of getYesterdayDate(int day)
public static String getYesterdayDate(int day)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { private static final String PATTERN = "yyyyMMdd"; public static String getYesterdayDate(int day) { java.util.Calendar calendar = java.util.Calendar.getInstance(); calendar.add(Calendar.DATE, -(day)); java.util.Date beginDate = calendar.getTime(); SimpleDateFormat dateFmt = new SimpleDateFormat(PATTERN); String yesterdayDate = dateFmt.format(beginDate); return yesterdayDate; }/*from w ww. j av a2 s . c o m*/ }