List of utility methods to do Yesterday
Date | getYesterday() get Yesterday return addDay(getDate("yyyy-MM-dd"), -1); |
Date | getYesterday() get Yesterday return getYesterday(DEFAULT_DATE_FORMAT);
|
String | getYesterday() get Yesterday return getDate(-1);
|
String | getYesterday() get Yesterday Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, -1); String yesterday = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime()); return yesterday; |
String | getYesterday() get Yesterday Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, -1); return formatDate(calendar.getTime(), "yyyy-MM-dd"); |
String | getYesterday() 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); |
String | getYesterDay() get Yester Day String operationtime = dateFormat.format(new java.util.Date(date.getTime() - 24 * 60 * 60 * 1000)); return operationtime; |
String | getYesterday() get Yesterday Date cDate = new Date(); cDate.setTime(cDate.getTime() - 24 * 3600 * 1000); SimpleDateFormat cSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); return cSimpleDateFormat.format(cDate); |
Date | getYesterday(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(); |
Date | getYesterday(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()));
|