List of utility methods to do Yesterday
Date | getYesterdaysDate() get Yesterdays Date Calendar cal = new GregorianCalendar(); cal.add(Calendar.DATE, -1); Date d = cal.getTime(); return d; |
Date | getYesterdayStartDate() 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();
...
|
String | getYesterdayString() get Yesterday String Date date = new Date(System.currentTimeMillis() - DATEMM * 1000L); String str = yyyyMMddHH_NOT_.format(date); return str; |
boolean | isYesterday(Date date) is Yesterday return isSameDay(date, rollDay(new Date(), -1)); |
Date | yesterday() yesterday return toYesterday(today());
|
String | yesterday() yesterday Calendar day = Calendar.getInstance();
day.add(Calendar.DATE, -1);
return df.format(day.getTime());
|
Calendar | yesterday() yesterday Calendar rtn = new GregorianCalendar(); rtn.add(Calendar.DATE, -1); return rtn; |
String | yesterDay() yester Day Calendar calendar = new GregorianCalendar(); calendar.add(Calendar.DATE, -1); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd"); return simpleDateFormat.format(calendar.getTime()); |
Date | yesterday() 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(); ... |
String | yesterday() 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(); ... |