Class CalendarUtil
java.lang.Object
com.google.gwt.user.datepicker.client.CalendarUtil
Useful utilities for creating views of a calendar.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddDaysToDate(Date date, int days) Adds the given number of days to a date.static voidaddMonthsToDate(Date date, int months) Adds the given number of months to a date.static DateCopies a date.static intgetDaysBetween(Date start, Date finish) Returns the number of days between the two dates.static intReturns the day of the week on which week starts in the current locale.static booleanisSameDate(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 booleanisWeekend(int dayOfWeek) Is a day in the week a weekend?static voidResets the date to have no time modifiers.static voidsetToFirstDayOfMonth(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
-