/** * Adds a number of years to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addYears(final Date date, final int amount) { return add(date, Calendar.YEAR, amount); }
/** * Adds a number of milliseconds to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addMilliseconds(final Date date, final int amount) { return add(date, Calendar.MILLISECOND, amount); }
/** * Adds a number of weeks to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addWeeks(final Date date, final int amount) { return add(date, Calendar.WEEK_OF_YEAR, amount); }
/** * Adds a number of hours to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addHours(final Date date, final int amount) { return add(date, Calendar.HOUR_OF_DAY, amount); }
/** * Adds a number of months to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addMonths(final Date date, final int amount) { return add(date, Calendar.MONTH, amount); }
/** * Adds a number of days to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addDays(final Date date, final int amount) { return add(date, Calendar.DAY_OF_MONTH, amount); }
/** * Adds a number of minutes to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addMinutes(final Date date, final int amount) { return add(date, Calendar.MINUTE, amount); }
/** * Adds a number of seconds to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addSeconds(final Date date, final int amount) { return add(date, Calendar.SECOND, amount); }
/** * Adds a number of months to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addMonths(final Date date, final int amount) { return add(date, Calendar.MONTH, amount); }
/** * Adds a number of weeks to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addWeeks(final Date date, final int amount) { return add(date, Calendar.WEEK_OF_YEAR, amount); }
/** * Adds a number of hours to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addHours(final Date date, final int amount) { return add(date, Calendar.HOUR_OF_DAY, amount); }
/** * Adds a number of minutes to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addMinutes(final Date date, final int amount) { return add(date, Calendar.MINUTE, amount); }
/** * Adds a number of months to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addMonths(final Date date, final int amount) { return add(date, Calendar.MONTH, amount); }
/** * Adds a number of weeks to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addWeeks(final Date date, final int amount) { return add(date, Calendar.WEEK_OF_YEAR, amount); }
/** * Adds a number of years to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addYears(final Date date, final int amount) { return add(date, Calendar.YEAR, amount); }
/** * Adds a number of seconds to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addSeconds(final Date date, final int amount) { return add(date, Calendar.SECOND, amount); }
/** * Adds a number of years to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addYears(final Date date, final int amount) { return add(date, Calendar.YEAR, amount); }
/** * Adds a number of seconds to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addSeconds(final Date date, final int amount) { return add(date, Calendar.SECOND, amount); }
/** * Adds a number of seconds to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addSeconds(final Date date, final int amount) { return add(date, Calendar.SECOND, amount); }
/** * Adds a number of days to a date returning a new object. * The original {@code Date} is unchanged. * * @param date the date, not null * @param amount the amount to add, may be negative * @return the new {@code Date} with the amount added * @throws IllegalArgumentException if the date is null */ public static Date addDays(final Date date, final int amount) { return add(date, Calendar.DAY_OF_MONTH, amount); }