Java Utililty Methods Date Add

List of utility methods to do Date Add

Description

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

Method

Dateadd(Date actual, Integer type, Integer count)
add
Calendar calendar = Calendar.getInstance();
calendar.setTime(actual);
calendar.add(type, count);
return calendar.getTime();
Dateadd(Date date, int calendarField, int amount)
Adds to a date returning a new object.
if (date == null) {
    throw new IllegalArgumentException("The date must not be null");
Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(calendarField, amount);
return c.getTime();
Dateadd(Date date, int calendarField, int amount)
Adds to a date returning a new object.
if (date == null) {
    throw new IllegalArgumentException("The date must not be null");
Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(calendarField, amount);
return c.getTime();
Dateadd(Date date, int calendarField, int amount)
Adds to a date returning a new object.
if (date == null) {
    throw new IllegalArgumentException("The date must not be null");
Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(calendarField, amount);
return c.getTime();
Dateadd(Date date, int field, int amount)
Date Arithmetic function.
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(field, amount);
return cal.getTime();
Dateadd(Date date, int field, int amount)
Date Arithmetic function.
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(field, amount);
return cal.getTime();
Dateadd(Date date, int field, int diff)
add
Calendar c = getCalendar(date);
c.add(field, diff);
return c.getTime();
Dateadd(Date date, int field, int value)
add
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(date.getTime());
cal.add(field, value);
return cal.getTime();
Dateadd(Date date, int field, long amount)
Adds the specified (signed) amount of time to the given time field, based on the calendar's rules.
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(field, (int) amount);
return calendar.getTime();
Dateadd(Date date, int x)
add
return addDays(date, x);