public class CalendarUtil
extends java.lang.Object
Constructor and Description |
---|
CalendarUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addDaysToDate(java.util.Date date,
int days)
Adds the given number of days to a date.
|
static void |
addMonthsToDate(java.util.Date date,
int months)
Adds the given number of months to a date.
|
static java.util.Date |
copyDate(java.util.Date date)
Copies a date.
|
static int |
getDaysBetween(java.util.Date start,
java.util.Date finish)
Returns the number of days between the two dates.
|
static int |
getStartingDayOfWeek()
Returns the day of the week on which week starts in the current locale.
|
static boolean |
isSameDate(java.util.Date date0,
java.util.Date date1)
Check if two dates represent the same date of the same year, even if they
have different times.
|
(package private) static boolean |
isWeekend(int dayOfWeek)
Is a day in the week a weekend?
|
static void |
resetTime(java.util.Date date)
Resets the date to have no time modifiers.
|
static void |
setToFirstDayOfMonth(java.util.Date date)
Sets a date object to be at the beginning of the month and no time
specified.
|
public static void addDaysToDate(java.util.Date date, int days)
date
- the datedays
- number of dayspublic static void addMonthsToDate(java.util.Date date, int months)
date
- the datemonths
- number of monthspublic static java.util.Date copyDate(java.util.Date date)
date
- the datepublic static int getDaysBetween(java.util.Date start, java.util.Date finish)
start
- starting datefinish
- ending datepublic static int getStartingDayOfWeek()
public static boolean isSameDate(java.util.Date date0, java.util.Date date1)
date0
- a datedate1
- a second datepublic static void setToFirstDayOfMonth(java.util.Date date)
date
- the datestatic boolean isWeekend(int dayOfWeek)
dayOfWeek
- day of weekpublic static void resetTime(java.util.Date date)
date
- the date