public class CalculateDateUtils extends 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 Date |
addDays(Date date,
int addDays)
Adds days to the given Date object and returns it.
|
static Date |
addHours(Date date,
int addHours)
Adds hours to the given Date object and returns it.
|
static Date |
addMinutes(Date date,
int addMinutes)
Adds minutes to the given Date object and returns it.
|
static Date |
addMonths(Date date,
int addMonths)
Adds months to the given Date object and returns it.
|
static Date |
addSeconds(Date date,
int addSeconds)
Adds seconds to the given Date object and returns it.
|
static Date |
addWeeks(Date date,
int addWeeks)
Adds weeks to the given Date object and returns it.
|
static Date |
addYears(Date date,
int addYears)
Adds years to the given Date object and returns it.
|
static boolean |
after(Date point,
Date when)
Returns true if the given from Date is after the given when Date otherwise false.
|
static boolean |
before(Date point,
Date when)
Returns true if the given from Date is before the given when Date otherwise false.
|
static long |
calculateElapsedTime(Date past,
Date now)
Calculates the elapsed time from the past to now.
|
static long |
calculateTimeFromNow(Date now,
Date future)
Calculates the elapsed time from the future to now.
|
static int |
computeAge(Date birthday,
Date computeDate)
Computes the Age from the birthday till the computeDate object.
|
static 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(Date start,
Date end,
Date between)
Checks if the Date object "between" is between from the given to Date
objects.
|
static boolean |
isDateInTheFuture(Date date)
Checks if the given date object is in the future.
|
static boolean |
isDateInThePast(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(String date,
String format,
boolean lenient)
Checks if the Date is valid to convert.
|
static Date |
substractDaysFromDate(Date date,
int substractDays)
Substract days to the given Date object and returns it.
|
static Date |
substractMonthsFromDate(Date date,
int substractMonths)
Substract months to the given Date object and returns it.
|
static Date |
substractWeeksFromDate(Date date,
int substractWeeks)
Substract weeks to the given Date object and returns it.
|
static Date |
substractYearsFromDate(Date date,
int substractYears)
Substract years to the given Date object and returns it.
|
public static Date addSeconds(Date date, int addSeconds)
date - The Date object to add the seconds.addSeconds - The seconds to add.public static Date addMinutes(Date date, int addMinutes)
date - The Date object to add the minutes.addMinutes - The days to add.public static Date addHours(Date date, int addHours)
date - The Date object to add the hours.addHours - The days to add.public static Date addDays(Date date, int addDays)
date - The Date object to add the days.addDays - The days to add.public static Date addWeeks(Date date, int addWeeks)
date - The Date object to add the weeks.addWeeks - The weeks to add.public static Date addMonths(Date date, int addMonths)
date - The Date object to add the years.addMonths - The months to add.public static Date addYears(Date date, int addYears)
date - The Date object to add the years.addYears - The years to add.public static long calculateElapsedTime(Date past, Date now)
past - The Date object in the past.now - The Date from now.public static long calculateTimeFromNow(Date now, Date future)
now - The Date from now.future - The Date in the future.public static int computeAge(Date birthday, Date computeDate)
birthday - The Date object from the birthday.computeDate - The Date-object from where to compute.public static 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(Date start, Date end, Date between)
start - the start time.end - the end time.between - the date to compare if it is between.public static boolean isDateInTheFuture(Date date)
date - The date to check.public static boolean isDateInThePast(Date date)
date - The date to check.public static boolean before(Date point, Date when)
point - the point of time from where to check if it is before.when - the whenpublic static boolean after(Date point, Date when)
point - the point of time from where to check if it is after.when - the whenpublic static boolean isLeapYear(int year)
year - The year to determine.public static boolean isValidDate(String date, 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 Date substractDaysFromDate(Date date, int substractDays)
date - The Date object to substract the days.substractDays - The days to substract.public static Date substractWeeksFromDate(Date date, int substractWeeks)
date - The Date object to substract the weeks.substractWeeks - The weeks to substract.public static Date substractMonthsFromDate(Date date, int substractMonths)
date - The Date object to substract the months.substractMonths - The months to substract.Copyright © 2007–2015 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.