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

Dateyesterday()
yesterday
return startOfDay(addDays(getCurrentDate(), -1));
Dateyesterday(Date date)
yesterday
Date newDate = (Date) date.clone();
long time = newDate.getTime() / 1000L - 86400L;
newDate.setTime(time * 1000L);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
try {
    newDate = format.parse(format.format(newDate));
} catch (Exception ex) {
    System.out.println(ex.getMessage());
...
Stringyesterday(int daybefore, String pattern)
yesterday
Calendar cal = yesterday(daybefore);
return new SimpleDateFormat(pattern).format(cal.getTime());
DateyesterdayDate()
yesterday Date
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.add(Calendar.DATE, -1);
return StringToDate(sdf.format(c.getTime()));
StringyesterdayDate3()
yesterday Date
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.set(Calendar.HOUR, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.DATE, cal.get(Calendar.DATE) - 1);
return convertDate2String4(cal.getTime());