API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.util. Calendar View Source
Author(s)
Mark Davis, David Goldsmith, Chen-Lieh Huang, Alan Liu
Since
JDK1.1
Version
1.88, 11/17/05
Serial
Hierarchy
 Object
      Calendar
Implements
 Serializable
 Cloneable
 Comparable
Subclasses
Description
publicabstract abstract class Calendar
  The Calendar class is an abstract class that provides methods for converting between a specific instant in time and a set of calendar fields such as YEAR, MONTH, DAY_OF_MONTH, HOUR, and so on, and for manipulating the calendar fields, such as getting the date of the next week.
Constructors
protected Calendar ()
  Constructs a Calendar with the default time zone and locale.
protected Calendar (TimeZone zone, Locale aLocale)
  Constructs a calendar with the specified time zone and locale.
Methods
Hide/Show inherited methods
publicabstract void add (int field, int amount)
  Adds or subtracts the specified amount of time to the given calendar field, based on the calendar's rules.
public boolean after (Object when)
  Returns whether this Calendar represents a time after the time represented by the specified Object.
public boolean before (Object when)
  Returns whether this Calendar represents a time before the time represented by the specified Object.
pack-private boolean checkDisplayNameParams (int field, int style, int minStyle, int maxStyle, Locale locale, int fieldMask)
publicfinal void clear ()
  Sets all the calendar field values and the time value (millisecond offset from the Epoch) of this Calendar undefined.
publicfinal void clear (int field)
  Sets the given calendar field value and the time value (millisecond offset from the Epoch) of this Calendar undefined.
public Object clone ()
  Creates and returns a copy of this object.
public int compareTo (Calendar anotherCalendar)
  Compares the time values (millisecond offsets from the Epoch) represented by two Calendar objects.
protected void complete ()
  Fills in any unset fields in the calendar fields.
protectedabstract void computeFields ()
  Converts the current millisecond time value Calendar.time to calendar field values in fields[].
protectedabstract void computeTime ()
  Converts the current calendar field values in fields[] to the millisecond time value Calendar.time.
public boolean equals (Object obj)
  Compares this Calendar to the specified Object.
public int get (int field)
  Returns the value of the given calendar field.
public int getActualMaximum (int field)
  Returns the maximum value that the specified calendar field could have, given the time value of this Calendar.
public int getActualMinimum (int field)
  Returns the minimum value that the specified calendar field could have, given the time value of this Calendar.
publicstaticsynchronized Locale getAvailableLocales ()
  Returns an array of all locales for which the getInstance methods of this class can return localized instances.
public String getDisplayName (int field, int style, Locale locale)
  Returns the string representation of the calendar field value in the given style and locale.
public Map<String, Integer> getDisplayNames (int field, int style, Locale locale)
  Returns a Map containing all names of the calendar field in the given style and locale and their corresponding field values.
pack-privatefinalstatic String getFieldName (int field)
  Returns the name of the specified calendar field.
public int getFirstDayOfWeek ()
  Gets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France.
publicabstract int getGreatestMinimum (int field)
  Returns the highest minimum value for the given calendar field of this Calendar instance.
publicstatic Calendar getInstance ()
  Gets a calendar using the default time zone and locale.
publicstatic Calendar getInstance (Locale aLocale)
  Gets a calendar using the default time zone and specified locale.
publicstatic Calendar getInstance (TimeZone zone)
  Gets a calendar using the specified time zone and default locale.
publicstatic Calendar getInstance (TimeZone zone, Locale aLocale)
  Gets a calendar with the specified time zone and locale.
publicabstract int getLeastMaximum (int field)
  Returns the lowest maximum value for the given calendar field of this Calendar instance.
publicabstract int getMaximum (int field)
  Returns the maximum value for the given calendar field of this Calendar instance.
public int getMinimalDaysInFirstWeek ()
  Gets what the minimal days required in the first week of the year are; e.g., if the first week is defined as one that contains the first day of the first month of a year, this method returns 1.
publicabstract int getMinimum (int field)
  Returns the minimum value for the given calendar field of this Calendar instance.
pack-privatefinal int getSetStateFields ()
  Returns a field mask (bit mask) indicating all calendar fields that have the state of externally or internally set.
publicfinal Date getTime ()
  Returns a Date object representing this Calendar's time value (millisecond offset from the Epoch").
public long getTimeInMillis ()
  Returns this Calendar's time value in milliseconds.
public TimeZone getTimeZone ()
  Gets the time zone.
pack-private TimeZone getZone ()
Returns the time zone (without cloning).
public int hashCode ()
  Returns a hash code for this calendar.
protectedfinal int internalGet (int field)
  Returns the value of the given calendar field.
pack-privatefinal void internalSet (int field, int value)
  Sets the value of the given calendar field.
pack-privatefinal boolean isExternallySet (int field)
  Returns whether the value of the specified calendar field has been set externally by calling one of the setter methods rather than by the internal time calculation.
pack-privatefinalstatic boolean isFieldSet (int fieldMask, int field)
Returns whether the specified field is on in the fieldMask.
pack-privatefinal boolean isFullyNormalized ()
Returns whether the calendar fields are fully in sync with the time value.
public boolean isLenient ()
  Tells whether date/time interpretation is to be lenient.
pack-privatefinal boolean isPartiallyNormalized ()
Returns whether the calendar fields are partially in sync with the time value or fully in sync but not stamp values are not normalized yet.
publicfinal boolean isSet (int field)
  Determines if the given calendar field has a value set, including cases that the value has been set by internal fields calculations triggered by a get method call.
publicabstract void roll (int field, boolean up)
  Adds or subtracts (up/down) a single unit of time on the given time field without changing larger fields.
public void roll (int field, int amount)
  Adds the specified (signed) amount to the specified calendar field without changing larger fields.
pack-privatefinal int selectFields ()
  Returns a field mask indicating which calendar field values to be used to calculate the time value.
public void set (int field, int value)
  Sets the given calendar field to the given value.
publicfinal void set (int year, int month, int date)
  Sets the values for the calendar fields YEAR, MONTH, and DAY_OF_MONTH.
publicfinal void set (int year, int month, int date, int hourOfDay, int minute)
  Sets the values for the calendar fields YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, and MINUTE.
publicfinal void set (int year, int month, int date, int hourOfDay, int minute, int second)
  Sets the values for the fields YEAR, MONTH, DAY_OF_MONTH, HOUR, MINUTE, and SECOND.
pack-privatefinal void setFieldsComputed (int fieldMask)
  Sets the state of the specified calendar fields to computed.
pack-privatefinal void setFieldsNormalized (int fieldMask)
  Sets the state of the calendar fields that are not specified by fieldMask to unset.
public void setFirstDayOfWeek (int value)
  Sets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France.
public void setLenient (boolean lenient)
  Specifies whether or not date/time interpretation is to be lenient.
public void setMinimalDaysInFirstWeek (int value)
  Sets what the minimal days required in the first week of the year are; For example, if the first week is defined as one that contains the first day of the first month of a year, call this method with value 1.
publicfinal void setTime (Date date)
  Sets this Calendar's time with the given Date.
public void setTimeInMillis (long millis)
  Sets this Calendar's current time from the given long value.
public void setTimeZone (TimeZone value)
  Sets the time zone with the given time zone value.
pack-privatefinal void setUnnormalized ()
Marks this Calendar as not sync'd.
pack-private void setZoneShared (boolean shared)
Sets the sharedZone flag to shared.
public String toString ()
  Return a string representation of this calendar.
Fields
Hide/Show inherited fields
pack-privatefinalstatic int ALL_FIELDS = "131071"
The mask value that represents all of the fields.
publicfinalstatic int ALL_STYLES = "0"
  A style specifier for getDisplayNames indicating names in all styles, such as "January" and "Jan".
publicfinalstatic int AM = "0"
Value of the Calendar.AM_PM field indicating the period of the day from midnight to just before noon.
publicfinalstatic int AM_PM = "9"
  Field number for get and set indicating whether the HOUR is before or after noon.
pack-privatefinalstatic int AM_PM_MASK = "512"
publicfinalstatic int APRIL = "3"
Value of the Calendar.MONTH field indicating the fourth month of the year in the Gregorian and Julian calendars.
pack-privatetransient boolean areAllFieldsSet
True if all fields have been set.
protected boolean areFieldsSet
  True if fields[] are in sync with the currently set time.
publicfinalstatic int AUGUST = "7"
Value of the Calendar.MONTH field indicating the eighth month of the year in the Gregorian and Julian calendars.
pack-privatefinalstatic int currentSerialVersion = "1"
publicfinalstatic int DATE = "5"
  Field number for get and set indicating the day of the month.
pack-privatefinalstatic int DATE_MASK = "32"
publicfinalstatic int DAY_OF_MONTH = "5"
  Field number for get and set indicating the day of the month.
pack-privatefinalstatic int DAY_OF_MONTH_MASK = "32"
publicfinalstatic int DAY_OF_WEEK = "7"
  Field number for get and set indicating the day of the week.
publicfinalstatic int DAY_OF_WEEK_IN_MONTH = "8"
  Field number for get and set indicating the ordinal number of the day of the week within the current month.
pack-privatefinalstatic int DAY_OF_WEEK_IN_MONTH_MASK = "256"
pack-privatefinalstatic int DAY_OF_WEEK_MASK = "128"
publicfinalstatic int DAY_OF_YEAR = "6"
  Field number for get and set indicating the day number within the current year.
pack-privatefinalstatic int DAY_OF_YEAR_MASK = "64"
publicfinalstatic int DECEMBER = "11"
Value of the Calendar.MONTH field indicating the twelfth month of the year in the Gregorian and Julian calendars.
publicfinalstatic int DST_OFFSET = "16"
  Field number for get and set indicating the daylight savings offset in milliseconds.
pack-privatefinalstatic int DST_OFFSET_MASK = "65536"
publicfinalstatic int ERA = "0"
  Field number for get and set indicating the era, e.g., AD or BC in the Julian calendar.
pack-privatefinalstatic int ERA_MASK = "1"
publicfinalstatic int FEBRUARY = "1"
Value of the Calendar.MONTH field indicating the second month of the year in the Gregorian and Julian calendars.
publicfinalstatic int FIELD_COUNT = "17"
  The number of distinct fields recognized by get and set.
protected int fields
  The calendar field values for the currently set time for this calendar.
publicfinalstatic int FRIDAY = "6"
Value of the Calendar.DAY_OF_WEEK field indicating Friday.
publicfinalstatic int HOUR = "10"
  Field number for get and set indicating the hour of the morning or afternoon.
pack-privatefinalstatic int HOUR_MASK = "1024"
publicfinalstatic int HOUR_OF_DAY = "11"
  Field number for get and set indicating the hour of the day.
pack-privatefinalstatic int HOUR_OF_DAY_MASK = "2048"
protected boolean isSet
  The flags which tell if a specified calendar field for the calendar is set.
protected boolean isTimeSet
  True if then the value of time is valid.
publicfinalstatic int JANUARY = "0"
Value of the Calendar.MONTH field indicating the first month of the year in the Gregorian and Julian calendars.
publicfinalstatic int JULY = "6"
Value of the Calendar.MONTH field indicating the seventh month of the year in the Gregorian and Julian calendars.
publicfinalstatic int JUNE = "5"
Value of the Calendar.MONTH field indicating the sixth month of the year in the Gregorian and Julian calendars.
publicfinalstatic int LONG = "2"
  A style specifier for getDisplayName and getDisplayNames indicating a long name, such as "January".
publicfinalstatic int MARCH = "2"
Value of the Calendar.MONTH field indicating the third month of the year in the Gregorian and Julian calendars.
publicfinalstatic int MAY = "4"
Value of the Calendar.MONTH field indicating the fifth month of the year in the Gregorian and Julian calendars.
publicfinalstatic int MILLISECOND = "14"
  Field number for get and set indicating the millisecond within the second.
pack-privatefinalstatic int MILLISECOND_MASK = "16384"
publicfinalstatic int MINUTE = "12"
  Field number for get and set indicating the minute within the hour.
pack-privatefinalstatic int MINUTE_MASK = "4096"
publicfinalstatic int MONDAY = "2"
Value of the Calendar.DAY_OF_WEEK field indicating Monday.
publicfinalstatic int MONTH = "2"
  Field number for get and set indicating the month.
pack-privatefinalstatic int MONTH_MASK = "4"
publicfinalstatic int NOVEMBER = "10"
Value of the Calendar.MONTH field indicating the eleventh month of the year in the Gregorian and Julian calendars.
publicfinalstatic int OCTOBER = "9"
Value of the Calendar.MONTH field indicating the tenth month of the year in the Gregorian and Julian calendars.
publicfinalstatic int PM = "1"
Value of the Calendar.AM_PM field indicating the period of the day from noon to just before midnight.
publicfinalstatic int SATURDAY = "7"
Value of the Calendar.DAY_OF_WEEK field indicating Saturday.
publicfinalstatic int SECOND = "13"
  Field number for get and set indicating the second within the minute.
pack-privatefinalstatic int SECOND_MASK = "8192"
publicfinalstatic int SEPTEMBER = "8"
Value of the Calendar.MONTH field indicating the ninth month of the year in the Gregorian and Julian calendars.
pack-privatefinalstatic long serialVersionUID = "-1807547505821590642"
publicfinalstatic int SHORT = "1"
  A style specifier for getDisplayName and getDisplayNames indicating a short name, such as "Jan".
publicfinalstatic int SUNDAY = "1"
Value of the Calendar.DAY_OF_WEEK field indicating Sunday.
publicfinalstatic int THURSDAY = "5"
Value of the Calendar.DAY_OF_WEEK field indicating Thursday.
protected long time
  The currently set time for this calendar, expressed in milliseconds after January 1, 1970, 0:00:00 GMT.
publicfinalstatic int TUESDAY = "3"
Value of the Calendar.DAY_OF_WEEK field indicating Tuesday.
publicfinalstatic int UNDECIMBER = "12"
  Value of the Calendar.MONTH field indicating the thirteenth month of the year.
publicfinalstatic int WEDNESDAY = "4"
Value of the Calendar.DAY_OF_WEEK field indicating Wednesday.
publicfinalstatic int WEEK_OF_MONTH = "4"
  Field number for get and set indicating the week number within the current month.
pack-privatefinalstatic int WEEK_OF_MONTH_MASK = "16"
publicfinalstatic int WEEK_OF_YEAR = "3"
  Field number for get and set indicating the week number within the current year.
pack-privatefinalstatic int WEEK_OF_YEAR_MASK = "8"
publicfinalstatic int YEAR = "1"
  Field number for get and set indicating the year.
pack-privatefinalstatic int YEAR_MASK = "2"
publicfinalstatic int ZONE_OFFSET = "15"
  Field number for get and set indicating the raw offset from GMT in milliseconds.
pack-privatefinalstatic int ZONE_OFFSET_MASK = "32768"
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar