public class

CalendarUtil

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

Class Overview

Useful utilities for creating views of a calendar.

Summary

Public Constructors
CalendarUtil()
Public Methods
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 setToFirstDayOfMonth(Date date)
Sets a date object to be at the beginning of the month and no time specified.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public CalendarUtil ()

Public Methods

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

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

public static Date copyDate (Date date)

Copies a date.

Parameters
date the date
Returns
  • the copy

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

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

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

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