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

DategetAfterDay(Date date, Integer day)
get After Day
if (null == date) {
    return null;
if (null == day) {
    return date;
} else {
    Calendar now = Calendar.getInstance();
    now.setTime(date);
...
intgetAfterDayNumber(Date endDate, Date startDate)
get After Day Number
Calendar cal = new GregorianCalendar();
cal.setTime(endDate);
cal.set(Calendar.HOUR_OF_DAY, cal.getActualMinimum(Calendar.HOUR_OF_DAY));
cal.set(Calendar.MINUTE, cal.getActualMinimum(Calendar.MINUTE));
cal.set(Calendar.SECOND, cal.getActualMinimum(Calendar.SECOND));
cal.set(Calendar.MILLISECOND, cal.getActualMinimum(Calendar.MILLISECOND));
Long date1 = cal.getTimeInMillis();
cal.setTime(startDate);
...
DategetAfterEndDate(Integer day)
get After End Date
Date date = new Date();
if (day == null) {
    return date;
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_MONTH, day);
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
...
DategetAfterMin(Date date, int min)
get After Min
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.MINUTE, calendar.get(Calendar.MINUTE) + min);
return calendar.getTime();
DategetDateAfter(Date d, int day)
get Date After
Calendar now = Calendar.getInstance();
now.setTime(d);
now.set(Calendar.DATE, now.get(Calendar.DATE) + day);
return now.getTime();
DategetDateAfter(Date date, int days)
Get date after/before base date.
Calendar cal = getCalendarDate(date);
cal.add(Calendar.DAY_OF_MONTH, days);
return cal.getTime();
DategetDateAfter(Date date, int increment)
get Date After
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
calendar.add(Calendar.DAY_OF_YEAR, increment);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
return calendar.getTime();
...
DategetDateAfterAddition(Date date, int days)
This method adds days to a date
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DATE, days);
return cal.getTime();
DategetDateAfterMonths(Date start, int months)
get Date After Months
return add(2, months, start);
Date[]getDateScopeAfterMonth(int year, int month)
get Date Scope After Month
Date[] date = new Date[2];
Calendar cal = new GregorianCalendar();
cal.set(Calendar.YEAR, year);
cal.set(Calendar.MONTH, month - 1);
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
cal.set(Calendar.HOUR_OF_DAY, cal.getActualMinimum(Calendar.HOUR_OF_DAY));
cal.set(Calendar.MINUTE, cal.getActualMinimum(Calendar.MINUTE));
cal.set(Calendar.SECOND, cal.getActualMinimum(Calendar.SECOND));
...