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

DategetYesterday()
get Yesterday
return addDay(getDate("yyyy-MM-dd"), -1);
DategetYesterday()
get Yesterday
return getYesterday(DEFAULT_DATE_FORMAT);
StringgetYesterday()
get Yesterday
return getDate(-1);
StringgetYesterday()
get Yesterday
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1);
String yesterday = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime());
return yesterday;
StringgetYesterday()
get Yesterday
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, -1);
return formatDate(calendar.getTime(), "yyyy-MM-dd");
StringgetYesterday()
get Yesterday
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
long time = (date.getTime() / 1000) - 60 * 60 * 24;
date.setTime(time * 1000);
return sdf.format(date);
StringgetYesterDay()
get Yester Day
String operationtime = dateFormat.format(new java.util.Date(date.getTime() - 24 * 60 * 60 * 1000));
return operationtime;
StringgetYesterday()
get Yesterday
Date cDate = new Date();
cDate.setTime(cDate.getTime() - 24 * 3600 * 1000);
SimpleDateFormat cSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
return cSimpleDateFormat.format(cDate);
DategetYesterday(Date date)
get Yesterday
Calendar c = Calendar.getInstance();
c.setTime(date);
int day = c.get(Calendar.DATE);
c.set(Calendar.DATE, day - 1);
return c.getTime();
DategetYesterday(Date date, Boolean isBefore, int interval)
get Yesterday
Calendar calendar = Calendar.getInstance(TimeZone.getDefault());
calendar.setTime(date);
calendar.add(Calendar.DATE, isBefore ? -interval : +interval);
return str2Date(date2Str(calendar.getTime()));