Class CalendarUtil
java.lang.Object
com.google.gwt.user.datepicker.client.CalendarUtil
Useful utilities for creating views of a calendar.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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
Copies a date.static int
getDaysBetween
(Date start, Date finish) Returns the number of days between the two dates.static int
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.(package private) static boolean
isWeekend
(int dayOfWeek) Is a day in the week a weekend?static void
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.
-
Constructor Details
-
CalendarUtil
public CalendarUtil()
-
-
Method Details
-
addDaysToDate
Adds the given number of days to a date.- Parameters:
date
- the datedays
- number of days
-
addMonthsToDate
Adds the given number of months to a date.- Parameters:
date
- the datemonths
- number of months
-
copyDate
Copies a date.- Parameters:
date
- the date- Returns:
- the copy
-
getDaysBetween
Returns the number of days between the two dates. Time is ignored.- Parameters:
start
- starting datefinish
- ending date- Returns:
- the different
-
getStartingDayOfWeek
public static int getStartingDayOfWeek()Returns the day of the week on which week starts in the current locale. The range between 0 for Sunday and 6 for Saturday.- Returns:
- the day of the week
-
isSameDate
Check if two dates represent the same date of the same year, even if they have different times.- Parameters:
date0
- a datedate1
- a second date- Returns:
- true if the dates are the same
-
setToFirstDayOfMonth
Sets a date object to be at the beginning of the month and no time specified.- Parameters:
date
- the date
-
isWeekend
static boolean isWeekend(int dayOfWeek) Is a day in the week a weekend?- Parameters:
dayOfWeek
- day of week- Returns:
- is the day of week a weekend?
-
resetTime
Resets the date to have no time modifiers. Note that the hour might not be zero if the time hits a DST transition date.- Parameters:
date
- the date
-