Java Utililty Methods Date After

List of utility methods to do Date After

Description

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

Method

DategetDateTimeAfter(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();
DategetMonthAfter(final Date _from, final int _mons)
get Month After
return getDateTimeAfter(_from, Calendar.MONTH, _mons);
StringgetNDayAfterCurrentDate(int n)
get N Day After Current Date
Calendar c = Calendar.getInstance();
c.add(Calendar.DAY_OF_MONTH, n);
return formatCalendarToyyyyMMdd(c);
DategetSpecifiedDayAfter(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();
DategetSpecifiedDayAfter4Date(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);
...
booleanisAfter(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);
...
booleanisAfter(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];
...
booleanisAfterForDay(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)) {
...
booleanisAfterHour(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;
booleanisAfterToday(Date dag)
is After Today
return getStartOfDay(dag) > getEndOfDay(new Date());