public class CalendarUtil extends Object
Constructor and Description |
---|
CalendarUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addDaysToDate(Date date,
int days)
Adds the given number of days to a date.
|
static void |
addMonthsToDate(Date date,
int months)
Adds the given number of months to a date.
|
static Date |
copyDate(Date date)
Copies a date.
|
static int |
getDaysBetween(Date start,
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(Date date0,
Date date1)
Check if two dates represent the same date of the same year, even if they
have different times.
|
static void |
resetTime(Date date)
Resets the date to have no time modifiers.
|
static void |
setToFirstDayOfMonth(Date date)
Sets a date object to be at the beginning of the month and no time
specified.
|
public static void addDaysToDate(Date date, int days)
date
- the datedays
- number of dayspublic static void addMonthsToDate(Date date, int months)
date
- the datemonths
- number of monthspublic static Date copyDate(Date date)
date
- the datepublic static int getDaysBetween(Date start, Date finish)
start
- starting datefinish
- ending datepublic static int getStartingDayOfWeek()
public static boolean isSameDate(Date date0, Date date1)
date0
- a datedate1
- a second datepublic static void setToFirstDayOfMonth(Date date)
date
- the datepublic static void resetTime(Date date)
date
- the dateCopyright © 2018. All rights reserved.