Calendardefines the followingintconstants, which are used when you get or set
components of the calendar:
510 Part II: The Java Library
Method Description
int get(intcalendarField) Returns the value of one component of the invoking
object. The component is indicated bycalendarField.
Examples of the components that can be requested
areCalendar.YEAR,Calendar.MONTH,
Calendar.MINUTE, and so forth.
static Locale[ ] getAvailableLocales( ) Returns an array ofLocaleobjects that contains
the locales for which calendars are available.
static Calendar getInstance( ) Returns aCalendarobject for the default locale and
time zone.
static Calendar getInstance(TimeZonetz) Returns aCalendarobject for the time zone
specified bytz.The default locale is used.
static Calendar getInstance(Localelocale) Returns aCalendarobject for the locale specified
bylocale.The default time zone is used.
static Calendar getInstance(TimeZonetz,
Localelocale)
Returns aCalendarobject for the time zone
specified bytzand the locale specified bylocale.
final Date getTime( ) Returns aDateobject equivalent to the time of the
invoking object.
TimeZone getTimeZone( ) Returns the time zone for the invoking object.
final boolean isSet(intwhich) Returnstrueif the specified time component is set.
Other wise, it returnsfalse.
void set(intwhich, intval) Sets the date or time component specified bywhich
to the value specified byvalin the invoking object.
whichmust be one of the fields defined by
Calendar, such asCalendar.HOUR.
final void set(intyear, intmonth,
intdayOfMonth)
Sets various date and time components of the
invoking object.
final void set(intyear, intmonth,
intdayOfMonth, inthours,
intminutes)
Sets various date and time components of the
invoking object.
final void set(intyear, intmonth,
intdayOfMonth, inthours,
intminutes, intseconds)
Sets various date and time components of the
invoking object.
final void setTime(Dated) Sets various date and time components of the
invoking object. This information is obtained from
theDateobjectd.
void setTimeZone(TimeZonetz) Sets the time zone for the invoking object to that
specified bytz.
TABLE 18-4 Commonly Used Methods Defined byCalendar(continued)