public final class CalculateDateExtensions extends java.lang.Object implements DatePatterns
DD_MMM_YY, DOT_DD_MM, DOT_DD_MM_YY, DOT_DD_MM_YYYY, DOT_DD_MM_YYYY_HH_MM_SS, DOT_YYYY_MM_DD_HH_MM_SS, EEE_MMM_DD_HH_MM_SS_Z_YYYY, EEEE_MMM_DD_YYYY, LHH_MM_SS, UHH_MM, UHH_MM_SS, YYYY_MM_DD, YYYY_MM_DD_HH_MM_SS, YYYY_MM_DD_HH_MM_SS_S, YYYY_MM_DD_T_HH_MM_SS, YYYYMMDDHHMMSS| Modifier and Type | Method and Description |
|---|---|
static java.util.Date |
addDays(java.util.Date date,
int addDays)
Adds days to the given Date object and returns it.
|
static java.util.Date |
addHours(java.util.Date date,
int addHours)
Adds hours to the given Date object and returns it.
|
static java.util.Date |
addMilliseconds(java.util.Date date,
int addMilliseconds)
Adds milliseconds to the given Date object and returns it.
|
static java.util.Date |
addMinutes(java.util.Date date,
int addMinutes)
Adds minutes to the given Date object and returns it.
|
static java.util.Date |
addMonths(java.util.Date date,
int addMonths)
Adds months to the given Date object and returns it.
|
static java.util.Date |
addSeconds(java.util.Date date,
int addSeconds)
Adds seconds to the given Date object and returns it.
|
static java.util.Date |
addWeeks(java.util.Date date,
int addWeeks)
Adds weeks to the given Date object and returns it.
|
static java.util.Date |
addYears(java.util.Date date,
int addYears)
Adds years to the given Date object and returns it.
|
static boolean |
after(java.util.Date point,
java.util.Date when)
Returns true if the given from Date is after the given when Date otherwise false.
|
static boolean |
before(java.util.Date point,
java.util.Date when)
Returns true if the given from Date is before the given when Date otherwise false.
|
static long |
calculateElapsedTime(java.util.Date past,
java.util.Date now)
Calculates the elapsed time from the past to now.
|
static int |
computeAge(java.util.Date birthday,
java.util.Date computeDate)
Computes the Age from the birthday till the computeDate object.
|
static java.util.Date |
computeEasternSunday(int year)
Computes the eastern sunday for the given year.
|
static int |
computeEasternSundayNumber(int year)
Computes the number from eastern sunday for the given year.
|
static boolean |
isBetween(java.util.Date start,
java.util.Date end,
java.util.Date between)
Checks if the Date object "between" is between from the given to Date objects.
|
static boolean |
isDateInTheFuture(java.util.Date date)
Checks if the given date object is in the future.
|
static boolean |
isDateInThePast(java.util.Date date)
Checks if the given date object is in the past.
|
static boolean |
isLeapYear(int year)
Determines if the given year is a leap year.
|
static boolean |
isValidDate(java.lang.String date,
java.lang.String format,
boolean lenient)
Checks if the Date is valid to convert.
|
static java.util.Date |
substractDaysFromDate(java.util.Date date,
int substractDays)
Substract days to the given Date object and returns it.
|
static java.util.Date |
substractMonthsFromDate(java.util.Date date,
int substractMonths)
Substract months to the given Date object and returns it.
|
static java.util.Date |
substractWeeksFromDate(java.util.Date date,
int substractWeeks)
Substract weeks to the given Date object and returns it.
|
static java.util.Date |
substractYearsFromDate(java.util.Date date,
int substractYears)
Substract years to the given Date object and returns it.
|
public static java.util.Date addDays(java.util.Date date,
int addDays)
date - The Date object to add the days.addDays - The days to add.public static java.util.Date addHours(java.util.Date date,
int addHours)
date - The Date object to add the hours.addHours - The days to add.public static java.util.Date addMilliseconds(java.util.Date date,
int addMilliseconds)
date - The Date object to add the milliseconds.addMilliseconds - The milliseconds to add.public static java.util.Date addMinutes(java.util.Date date,
int addMinutes)
date - The Date object to add the minutes.addMinutes - The days to add.public static java.util.Date addMonths(java.util.Date date,
int addMonths)
date - The Date object to add the years.addMonths - The months to add.public static java.util.Date addSeconds(java.util.Date date,
int addSeconds)
date - The Date object to add the seconds.addSeconds - The seconds to add.public static java.util.Date addWeeks(java.util.Date date,
int addWeeks)
date - The Date object to add the weeks.addWeeks - The weeks to add.public static java.util.Date addYears(java.util.Date date,
int addYears)
date - The Date object to add the years.addYears - The years to add.public static boolean after(java.util.Date point,
java.util.Date when)
point - the point of time from where to check if it is after.when - the whenpublic static boolean before(java.util.Date point,
java.util.Date when)
point - the point of time from where to check if it is before.when - the whenpublic static long calculateElapsedTime(java.util.Date past,
java.util.Date now)
past - The Date object in the past.now - The Date from now.public static int computeAge(java.util.Date birthday,
java.util.Date computeDate)
birthday - The Date object from the birthday.computeDate - The Date-object from where to compute.public static java.util.Date computeEasternSunday(int year)
year - The year to compute the eastern sunday.public static int computeEasternSundayNumber(int year)
year - The year to compute the number from eastern sunday.public static boolean isBetween(java.util.Date start,
java.util.Date end,
java.util.Date between)
start - the start time.end - the end time.between - the date to compare if it is between.public static boolean isDateInTheFuture(java.util.Date date)
date - The date to check.public static boolean isDateInThePast(java.util.Date date)
date - The date to check.public static boolean isLeapYear(int year)
year - The year to determine.public static boolean isValidDate(java.lang.String date,
java.lang.String format,
boolean lenient)
date - The Date as Stringformat - The Format for the Date to parselenient - Specify whether or not date/time interpretation is to be lenient.public static java.util.Date substractDaysFromDate(java.util.Date date,
int substractDays)
date - The Date object to substract the days.substractDays - The days to substract.public static java.util.Date substractMonthsFromDate(java.util.Date date,
int substractMonths)
date - The Date object to substract the months.substractMonths - The months to substract.public static java.util.Date substractWeeksFromDate(java.util.Date date,
int substractWeeks)
date - The Date object to substract the weeks.substractWeeks - The weeks to substract.public static java.util.Date substractYearsFromDate(java.util.Date date,
int substractYears)
date - The Date object to substract the years.substractYears - The years to substract.