Java Utililty Methods Yesterday

List of utility methods to do Yesterday

Description

The list of methods to do Yesterday are organized into topic(s).

Method

DategetYesterdaysDate()
get Yesterdays Date
Calendar cal = new GregorianCalendar();
cal.add(Calendar.DATE, -1);
Date d = cal.getTime();
return d;
DategetYesterdayStartDate()
Get the date for yesterday (based on system time).
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.DATE, -1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTime();
...
StringgetYesterdayString()
get Yesterday String
Date date = new Date(System.currentTimeMillis() - DATEMM * 1000L);
String str = yyyyMMddHH_NOT_.format(date);
return str;
booleanisYesterday(Date date)
is Yesterday
return isSameDay(date, rollDay(new Date(), -1));
Dateyesterday()
yesterday
return toYesterday(today());
Stringyesterday()
yesterday
Calendar day = Calendar.getInstance();
day.add(Calendar.DATE, -1);
return df.format(day.getTime());
Calendaryesterday()
yesterday
Calendar rtn = new GregorianCalendar();
rtn.add(Calendar.DATE, -1);
return rtn;
StringyesterDay()
yester Day
Calendar calendar = new GregorianCalendar();
calendar.add(Calendar.DATE, -1);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
return simpleDateFormat.format(calendar.getTime());
Dateyesterday()
yesterday
final Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(DAY, -1);
calendar.set(Calendar.HOUR, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTime();
...
Stringyesterday()
yesterday
Date td = new Date();
Date tmr = new Date(td.getTime() - 86400000L);
String tomorrow = tmr.toLocaleString().split(" ")[0];
String tArr[] = tomorrow.split("-");
if (tArr[1].length() < 2)
    tArr[1] = (new StringBuffer("0")).append(tArr[1]).toString();
if (tArr[2].length() < 2)
    tArr[2] = (new StringBuffer("0")).append(tArr[2]).toString();
...