List of utility methods to do Date Subtract
Date | substractDaysFromDate(final Date date, final int substractDays) Substract days to the given Date object and returns it. final Calendar dateOnCalendar = Calendar.getInstance(); dateOnCalendar.setTime(date); dateOnCalendar.add(Calendar.DATE, substractDays * -1); return dateOnCalendar.getTime(); |
Date | subtract(Date date, int num) subtract Calendar canlendar = Calendar.getInstance();
canlendar.setTime(date);
canlendar.add(Calendar.DATE, -num);
return canlendar.getTime();
|
java.util.Date | subtractCertainYears(java.util.Date date, Integer years) subtract Certain Years java.util.Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.YEAR, -years);
return cal.getTime();
|
Date | subtractDate(Date date, int type, Integer quantity) subtract Date return manipulateDate(date, type, quantity, SUBTRACT);
|
Date | subtractDate(Date date, int type, Integer quantity) subtract Date return manipulateDate(date, type, quantity, SUBTRACT);
|
Date | subtractDay(final Date date) Subtract one day from the supplied date return addDays(date, -1);
|
Date | subtractDays(Date dt, int days) Subtract a number of days Calendar cal = Calendar.getInstance();
cal.setTime(dt);
cal.add(Calendar.DATE, -days);
return cal.getTime();
|
Date | subtractDurationToDate(Date date, String duration) Subtracts duration to date final int negative = -1; Date computedDate = null; computedDate = computeDateFromDurationDate(date, duration, negative); computedDate = computeDateFromDurationTime(computedDate, duration, negative); return computedDate; |
long | subtractNowDay(Date date) subtract Now Day final int aDaymi = 24 * 60 * 60 * 1000; Calendar calendar = Calendar.getInstance(); calendar.setTime(date); long dateTimeInMillis = calendar.getTimeInMillis(); Calendar nowCalendar = Calendar.getInstance(); nowCalendar.setTime(new Date()); long nowTimeInMillis = nowCalendar.getTimeInMillis(); return (nowTimeInMillis - dateTimeInMillis) / (aDaymi); ... |
Date | subtractOrAddDayDuration(Date date, int duration) subtract Or Add Day Duration Calendar cal = new GregorianCalendar(); cal.setTime(date); cal.add(Calendar.DAY_OF_MONTH, duration); Date dateExpect = cal.getTime(); return dateExpect; |