Class CalendarUtil

java.lang.Object
com.google.gwt.user.datepicker.client.CalendarUtil

public class CalendarUtil extends Object
Useful utilities for creating views of a calendar.
  • Constructor Details

    • CalendarUtil

      public CalendarUtil()
  • Method Details

    • addDaysToDate

      public static void addDaysToDate(Date date, int days)
      Adds the given number of days to a date.
      Parameters:
      date - the date
      days - number of days
    • addMonthsToDate

      public static void addMonthsToDate(Date date, int months)
      Adds the given number of months to a date.
      Parameters:
      date - the date
      months - number of months
    • copyDate

      public static Date copyDate(Date date)
      Copies a date.
      Parameters:
      date - the date
      Returns:
      the copy
    • getDaysBetween

      public static int getDaysBetween(Date start, Date finish)
      Returns the number of days between the two dates. Time is ignored.
      Parameters:
      start - starting date
      finish - 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

      public 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.
      Parameters:
      date0 - a date
      date1 - a second date
      Returns:
      true if the dates are the same
    • setToFirstDayOfMonth

      public static void setToFirstDayOfMonth(Date date)
      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

      public static void resetTime(Date date)
      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