List of utility methods to do Date After
Date | getDateTimeAfter(final Date _from, final int _time_type, final int _count) get Date Time After final Calendar c = Calendar.getInstance(); if (_from != null) { c.setTime(_from); c.add(_time_type, _count); return c.getTime(); |
Date | getMonthAfter(final Date _from, final int _mons) get Month After return getDateTimeAfter(_from, Calendar.MONTH, _mons);
|
String | getNDayAfterCurrentDate(int n) get N Day After Current Date Calendar c = Calendar.getInstance();
c.add(Calendar.DAY_OF_MONTH, n);
return formatCalendarToyyyyMMdd(c);
|
Date | getSpecifiedDayAfter(Date date, int num) get Specified Day After Calendar c = Calendar.getInstance(); c.setTime(date); int day = c.get(Calendar.DATE); c.set(Calendar.DATE, day + num); return c.getTime(); |
Date | getSpecifiedDayAfter4Date(Date date) get Specified Day After Date try { Calendar c = Calendar.getInstance(); c.setTime(date); int day = c.get(Calendar.DATE); c.set(Calendar.HOUR, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); c.set(Calendar.DATE, day + 1); ... |
boolean | isAfter(Date d1, Date d2) Checks if one date falls on a later calendar day than another. GregorianCalendar tcal = new GregorianCalendar(); tcal.setTime(d1); tcal.set(Calendar.HOUR_OF_DAY, 0); tcal.set(Calendar.MINUTE, 0); tcal.set(Calendar.SECOND, 0); GregorianCalendar dcal = new GregorianCalendar(); dcal.setTime(d2); dcal.set(Calendar.HOUR_OF_DAY, 0); ... |
boolean | isAfter(Date date1, Date date2) Checks if date1 is after date2. int[] dIng1 = getDateIngredients(date1); int day1 = dIng1[0]; int month1 = dIng1[1]; int year1 = dIng1[2]; int[] dIng2 = getDateIngredients(date2); int day2 = dIng2[0]; int month2 = dIng2[1]; int year2 = dIng2[2]; ... |
boolean | isAfterForDay(Date date, Date ref) check if date is after other date. if (ref == null) { return true; Calendar calDate = Calendar.getInstance(); calDate.setTime(date); Calendar calRef = Calendar.getInstance(); calRef.setTime(ref); if (calDate.get(Calendar.YEAR) < calRef.get(Calendar.YEAR)) { ... |
boolean | isAfterHour(Date source, int hour) is After Hour Calendar c = Calendar.getInstance(); c.setTime(source); int hourOfDay = c.get(Calendar.HOUR_OF_DAY); if (hourOfDay - hour >= 0) { return true; } else { return false; |
boolean | isAfterToday(Date dag) is After Today return getStartOfDay(dag) > getEndOfDay(new Date()); |