Java Utililty Methods Date Previous

List of utility methods to do Date Previous

Description

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

Method

DatepreviousDay(Date date)
previous Day
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DAY_OF_MONTH, -1);
return cal.getTime();
longpreviousDay(long date)
Returns the day before date.
return addDays(date, -1);
longpreviousDay(long date)
Returns the day before date.
return addDays(date, -1);
DatepreviousDayLastHour(final Date pDate)
Return last time of previous day for between comparison.
final Calendar c = Calendar.getInstance();
c.setTime(pDate);
c.set(Calendar.HOUR_OF_DAY, c.getMaximum(Calendar.HOUR_OF_DAY));
c.set(Calendar.MINUTE, c.getMaximum(Calendar.MINUTE));
c.set(Calendar.SECOND, c.getMaximum(Calendar.SECOND));
c.set(Calendar.MILLISECOND, c.getMaximum(Calendar.MILLISECOND));
c.add(Calendar.DATE, -1);
return c.getTime();
...