API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.util. GregorianCalendar View Source
Author(s)
David Goldsmith, Mark Davis, Chen-Lieh Huang, Alan Liu
Since
JDK1.1
Version
1.92
Serial
Hierarchy
 Object
      Calendar
          GregorianCalendar
Implements
Subclasses
Description
public class GregorianCalendar
  GregorianCalendar is a concrete subclass of Calendar and provides the standard calendar system used by most of the world.
See also:    TimeZone
Constructors
public GregorianCalendar ()
Constructs a default GregorianCalendar using the current time in the default time zone with the default locale.
public GregorianCalendar (int year, int month, int dayOfMonth)
  Constructs a GregorianCalendar with the given date set in the default time zone with the default locale.
public GregorianCalendar (int year, int month, int dayOfMonth, int hourOfDay, int minute)
  Constructs a GregorianCalendar with the given date and time set for the default time zone with the default locale.
public GregorianCalendar (int year, int month, int dayOfMonth, int hourOfDay, int minute, int second)
  Constructs a GregorianCalendar with the given date and time set for the default time zone with the default locale.
pack-private GregorianCalendar (int year, int month, int dayOfMonth, int hourOfDay, int minute, int second, int millis)
  Constructs a GregorianCalendar with the given date and time set for the default time zone with the default locale.
public GregorianCalendar (Locale aLocale)
  Constructs a GregorianCalendar based on the current time in the default time zone with the given locale.
public GregorianCalendar (TimeZone zone)
  Constructs a GregorianCalendar based on the current time in the given time zone with the default locale.
public GregorianCalendar (TimeZone zone, Locale aLocale)
  Constructs a GregorianCalendar based on the current time in the given time zone with the given locale.
Methods
Hide/Show inherited methods
public void add (int field, int amount) [Specified in Calendar]
  Adds the specified (signed) amount of time to the given calendar field, based on the calendar's rules.
public boolean after (Object when) [Inherited From Calendar]
  Returns whether this Calendar represents a time after the time represented by the specified Object.
public boolean before (Object when) [Inherited From Calendar]
  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) [Inherited From Calendar]
publicfinal void clear () [Inherited From Calendar]
  Sets all the calendar field values and the time value (millisecond offset from the Epoch) of this Calendar undefined.
publicfinal void clear (int field) [Inherited From Calendar]
  Sets the given calendar field value and the time value (millisecond offset from the Epoch) of this Calendar undefined.
public Object clone () [Overrides Calendar]
public int compareTo (Calendar anotherCalendar) [Inherited From Calendar]
  Compares the time values (millisecond offsets from the Epoch) represented by two Calendar objects.
protected void complete () [Inherited From Calendar]
  Fills in any unset fields in the calendar fields.
protected void computeFields () [Specified in Calendar]
  Converts the time value (millisecond offset from the Epoch) to calendar field values.
protected void computeTime () [Specified in Calendar]
  Converts calendar field values to the time value (millisecond offset from the Epoch).
public boolean equals (Object obj) [Overrides Calendar]
  Compares this GregorianCalendar to the specified Object.
public int get (int field) [Inherited From Calendar]
  Returns the value of the given calendar field.
public int getActualMaximum (int field) [Overrides Calendar]
  Returns the maximum value that this calendar field could have, taking into consideration the given time value and the current values of the getFirstDayOfWeek, getMinimalDaysInFirstWeek, getGregorianChange and getTimeZone methods.
public int getActualMinimum (int field) [Overrides Calendar]
  Returns the minimum value that this calendar field could have, taking into consideration the given time value and the current values of the getFirstDayOfWeek, getMinimalDaysInFirstWeek, getGregorianChange and getTimeZone methods.
publicstaticsynchronized Locale getAvailableLocales () [Inherited From Calendar]
  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) [Inherited From Calendar]
  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) [Inherited From Calendar]
  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) [Inherited From Calendar]
  Returns the name of the specified calendar field.
public int getFirstDayOfWeek () [Inherited From Calendar]
  Gets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France.
public int getGreatestMinimum (int field) [Specified in Calendar]
  Returns the highest minimum value for the given calendar field of this GregorianCalendar instance.
publicfinal Date getGregorianChange ()
  Gets the Gregorian Calendar change date.
publicstatic Calendar getInstance () [Inherited From Calendar]
  Gets a calendar using the default time zone and locale.
publicstatic Calendar getInstance (Locale aLocale) [Inherited From Calendar]
  Gets a calendar using the default time zone and specified locale.
publicstatic Calendar getInstance (TimeZone zone) [Inherited From Calendar]
  Gets a calendar using the specified time zone and default locale.
publicstatic Calendar getInstance (TimeZone zone, Locale aLocale) [Inherited From Calendar]
  Gets a calendar with the specified time zone and locale.
public int getLeastMaximum (int field) [Specified in Calendar]
  Returns the lowest maximum value for the given calendar field of this GregorianCalendar instance.
public int getMaximum (int field) [Specified in Calendar]
  Returns the maximum value for the given calendar field of this GregorianCalendar instance.
public int getMinimalDaysInFirstWeek () [Inherited From Calendar]
  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.
public int getMinimum (int field) [Specified in Calendar]
  Returns the minimum value for the given calendar field of this GregorianCalendar instance.
pack-privatefinal int getSetStateFields () [Inherited From Calendar]
  Returns a field mask (bit mask) indicating all calendar fields that have the state of externally or internally set.
publicfinal Date getTime () [Inherited From Calendar]
  Returns a Date object representing this Calendar's time value (millisecond offset from the Epoch").
public long getTimeInMillis () [Inherited From Calendar]
  Returns this Calendar's time value in milliseconds.
public TimeZone getTimeZone () [Overrides Calendar]
pack-private TimeZone getZone () [Inherited From Calendar]
Returns the time zone (without cloning).
public int hashCode () [Overrides Calendar]
Generates the hash code for this GregorianCalendar object.
protectedfinal int internalGet (int field) [Inherited From Calendar]
  Returns the value of the given calendar field.
pack-privatefinal void internalSet (int field, int value) [Inherited From Calendar]
  Sets the value of the given calendar field.
pack-privatefinal boolean isExternallySet (int field) [Inherited From Calendar]
  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) [Inherited From Calendar]
Returns whether the specified field is on in the fieldMask.
pack-privatefinal boolean isFullyNormalized () [Inherited From Calendar]
Returns whether the calendar fields are fully in sync with the time value.
public boolean isLeapYear (int year)
  Determines if the given year is a leap year.
public boolean isLenient () [Inherited From Calendar]
  Tells whether date/time interpretation is to be lenient.
pack-privatefinal boolean isPartiallyNormalized () [Inherited From Calendar]
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) [Inherited From Calendar]
  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.
public void roll (int field, boolean up) [Specified in Calendar]
  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) [Overrides Calendar]
  Adds a signed amount to the specified calendar field without changing larger fields.
pack-privatefinal int selectFields () [Inherited From Calendar]
  Returns a field mask indicating which calendar field values to be used to calculate the time value.
public void set (int field, int value) [Inherited From Calendar]
  Sets the given calendar field to the given value.
publicfinal void set (int year, int month, int date) [Inherited From Calendar]
  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) [Inherited From Calendar]
  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) [Inherited From Calendar]
  Sets the values for the fields YEAR, MONTH, DAY_OF_MONTH, HOUR, MINUTE, and SECOND.
pack-privatefinal void setFieldsComputed (int fieldMask) [Inherited From Calendar]
  Sets the state of the specified calendar fields to computed.
pack-privatefinal void setFieldsNormalized (int fieldMask) [Inherited From Calendar]
  Sets the state of the calendar fields that are not specified by fieldMask to unset.
public void setFirstDayOfWeek (int value) [Inherited From Calendar]
  Sets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France.
public void setGregorianChange (Date date)
  Sets the GregorianCalendar change date.
public void setLenient (boolean lenient) [Inherited From Calendar]
  Specifies whether or not date/time interpretation is to be lenient.
public void setMinimalDaysInFirstWeek (int value) [Inherited From Calendar]
  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) [Inherited From Calendar]
  Sets this Calendar's time with the given Date.
public void setTimeInMillis (long millis) [Inherited From Calendar]
  Sets this Calendar's current time from the given long value.
public void setTimeZone (TimeZone zone) [Overrides Calendar]
pack-privatefinal void setUnnormalized () [Inherited From Calendar]
Marks this Calendar as not sync'd.
pack-private void setZoneShared (boolean shared) [Inherited From Calendar]
Sets the sharedZone flag to shared.
public String toString () [Inherited From Calendar]
  Return a string representation of this calendar.
Fields
Hide/Show inherited fields
publicfinalstatic int AD = "1"
  Value of the ERA field indicating the common era (Anno Domini), also known as CE.
pack-privatefinalstatic int ALL_FIELDS = "131071" [Inherited From Calendar]
The mask value that represents all of the fields.
publicfinalstatic int ALL_STYLES = "0" [Inherited From Calendar]
  A style specifier for getDisplayNames indicating names in all styles, such as "January" and "Jan".
publicfinalstatic int AM = "0" [Inherited From Calendar]
Value of the Calendar.AM_PM field indicating the period of the day from midnight to just before noon.
publicfinalstatic int AM_PM = "9" [Inherited From Calendar]
  Field number for get and set indicating whether the HOUR is before or after noon.
pack-privatefinalstatic int AM_PM_MASK = "512" [Inherited From Calendar]
publicfinalstatic int APRIL = "3" [Inherited From Calendar]
Value of the Calendar.MONTH field indicating the fourth month of the year in the Gregorian and Julian calendars.
pack-privatetransient boolean areAllFieldsSet [Inherited From Calendar]
True if all fields have been set.
protected boolean areFieldsSet [Inherited From Calendar]
  True if fields[] are in sync with the currently set time.
publicfinalstatic int AUGUST = "7" [Inherited From Calendar]
Value of the Calendar.MONTH field indicating the eighth month of the year in the Gregorian and Julian calendars.
publicfinalstatic int BC = "0"
  Value of the ERA field indicating the period before the common era (before Christ), also known as BCE.
pack-privatefinalstatic int BCE = "0"
  Value of the Calendar.ERA field indicating the period before the common era, the same value as GregorianCalendar.BC.
pack-privatefinalstatic int CE = "1"
  Value of the Calendar.ERA field indicating the common era, the same value as GregorianCalendar.AD.
pack-privatefinalstatic int currentSerialVersion = "1" [Inherited From Calendar]
publicfinalstatic int DATE = "5" [Inherited From Calendar]
  Field number for get and set indicating the day of the month.
pack-privatefinalstatic int DATE_MASK = "32" [Inherited From Calendar]
publicfinalstatic int DAY_OF_MONTH = "5" [Inherited From Calendar]
  Field number for get and set indicating the day of the month.
pack-privatefinalstatic int DAY_OF_MONTH_MASK = "32" [Inherited From Calendar]
publicfinalstatic int DAY_OF_WEEK = "7" [Inherited From Calendar]
  Field number for get and set indicating the day of the week.
publicfinalstatic int DAY_OF_WEEK_IN_MONTH = "8" [Inherited From Calendar]
  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" [Inherited From Calendar]
pack-privatefinalstatic int DAY_OF_WEEK_MASK = "128" [Inherited From Calendar]
publicfinalstatic int DAY_OF_YEAR = "6" [Inherited From Calendar]
  Field number for get and set indicating the day number within the current year.
pack-privatefinalstatic int DAY_OF_YEAR_MASK = "64" [Inherited From Calendar]
publicfinalstatic int DECEMBER = "11" [Inherited From Calendar]
Value of the Calendar.MONTH field indicating the twelfth month of the year in the Gregorian and Julian calendars.
pack-privatefinalstatic long DEFAULT_GREGORIAN_CUTOVER = "-12219292800000"
publicfinalstatic int DST_OFFSET = "16" [Inherited From Calendar]
  Field number for get and set indicating the daylight savings offset in milliseconds.
pack-privatefinalstatic int DST_OFFSET_MASK = "65536" [Inherited From Calendar]
publicfinalstatic int ERA = "0" [Inherited From Calendar]
  Field number for get and set indicating the era, e.g., AD or BC in the Julian calendar.
pack-privatefinalstatic int ERA_MASK = "1" [Inherited From Calendar]
publicfinalstatic int FEBRUARY = "1" [Inherited From Calendar]
Value of the Calendar.MONTH field indicating the second month of the year in the Gregorian and Julian calendars.
publicfinalstatic int FIELD_COUNT = "17" [Inherited From Calendar]
  The number of distinct fields recognized by get and set.
protected int fields [Inherited From Calendar]
  The calendar field values for the currently set time for this calendar.
publicfinalstatic int FRIDAY = "6" [Inherited From Calendar]
Value of the Calendar.DAY_OF_WEEK field indicating Friday.
publicfinalstatic int HOUR = "10" [Inherited From Calendar]
  Field number for get and set indicating the hour of the morning or afternoon.
pack-privatefinalstatic int HOUR_MASK = "1024" [Inherited From Calendar]
publicfinalstatic int HOUR_OF_DAY = "11" [Inherited From Calendar]
  Field number for get and set indicating the hour of the day.
pack-privatefinalstatic int HOUR_OF_DAY_MASK = "2048" [Inherited From Calendar]
protected boolean isSet [Inherited From Calendar]
  The flags which tell if a specified calendar field for the calendar is set.
protected boolean isTimeSet [Inherited From Calendar]
  True if then the value of time is valid.
publicfinalstatic int JANUARY = "0" [Inherited From Calendar]
Value of the Calendar.MONTH field indicating the first month of the year in the Gregorian and Julian calendars.
publicfinalstatic int JULY = "6" [Inherited From Calendar]
Value of the Calendar.MONTH field indicating the seventh month of the year in the Gregorian and Julian calendars.
publicfinalstatic int JUNE = "5" [Inherited From Calendar]
Value of the Calendar.MONTH field indicating the sixth month of the year in the Gregorian and Julian calendars.
pack-privatefinalstatic int LEAP_MONTH_LENGTH
pack-privatefinalstatic int LEAST_MAX_VALUES
publicfinalstatic int LONG = "2" [Inherited From Calendar]
  A style specifier for getDisplayName and getDisplayNames indicating a long name, such as "January".
publicfinalstatic int MARCH = "2" [Inherited From Calendar]
Value of the Calendar.MONTH field indicating the third month of the year in the Gregorian and Julian calendars.
pack-privatefinalstatic int MAX_VALUES
publicfinalstatic int MAY = "4" [Inherited From Calendar]
Value of the Calendar.MONTH field indicating the fifth month of the year in the Gregorian and Julian calendars.
publicfinalstatic int MILLISECOND = "14" [Inherited From Calendar]
  Field number for get and set indicating the millisecond within the second.
pack-privatefinalstatic int MILLISECOND_MASK = "16384" [Inherited From Calendar]
pack-privatefinalstatic int MIN_VALUES
publicfinalstatic int MINUTE = "12" [Inherited From Calendar]
  Field number for get and set indicating the minute within the hour.
pack-privatefinalstatic int MINUTE_MASK = "4096" [Inherited From Calendar]
publicfinalstatic int MONDAY = "2" [Inherited From Calendar]
Value of the Calendar.DAY_OF_WEEK field indicating Monday.
publicfinalstatic int MONTH = "2" [Inherited From Calendar]
  Field number for get and set indicating the month.
pack-privatefinalstatic int MONTH_LENGTH
pack-privatefinalstatic int MONTH_MASK = "4" [Inherited From Calendar]
publicfinalstatic int NOVEMBER = "10" [Inherited From Calendar]
Value of the Calendar.MONTH field indicating the eleventh month of the year in the Gregorian and Julian calendars.
publicfinalstatic int OCTOBER = "9" [Inherited From Calendar]
Value of the Calendar.MONTH field indicating the tenth month of the year in the Gregorian and Julian calendars.
publicfinalstatic int PM = "1" [Inherited From Calendar]
Value of the Calendar.AM_PM field indicating the period of the day from noon to just before midnight.
publicfinalstatic int SATURDAY = "7" [Inherited From Calendar]
Value of the Calendar.DAY_OF_WEEK field indicating Saturday.
publicfinalstatic int SECOND = "13" [Inherited From Calendar]
  Field number for get and set indicating the second within the minute.
pack-privatefinalstatic int SECOND_MASK = "8192" [Inherited From Calendar]
publicfinalstatic int SEPTEMBER = "8" [Inherited From Calendar]
Value of the Calendar.MONTH field indicating the ninth month of the year in the Gregorian and Julian calendars.
pack-privatefinalstatic long serialVersionUID = "-8125100834729963327" [Overrides Calendar]
publicfinalstatic int SHORT = "1" [Inherited From Calendar]
  A style specifier for getDisplayName and getDisplayNames indicating a short name, such as "Jan".
publicfinalstatic int SUNDAY = "1" [Inherited From Calendar]
Value of the Calendar.DAY_OF_WEEK field indicating Sunday.
publicfinalstatic int THURSDAY = "5" [Inherited From Calendar]
Value of the Calendar.DAY_OF_WEEK field indicating Thursday.
protected long time [Inherited From Calendar]
  The currently set time for this calendar, expressed in milliseconds after January 1, 1970, 0:00:00 GMT.
publicfinalstatic int TUESDAY = "3" [Inherited From Calendar]
Value of the Calendar.DAY_OF_WEEK field indicating Tuesday.
publicfinalstatic int UNDECIMBER = "12" [Inherited From Calendar]
  Value of the Calendar.MONTH field indicating the thirteenth month of the year.
publicfinalstatic int WEDNESDAY = "4" [Inherited From Calendar]
Value of the Calendar.DAY_OF_WEEK field indicating Wednesday.
publicfinalstatic int WEEK_OF_MONTH = "4" [Inherited From Calendar]
  Field number for get and set indicating the week number within the current month.
pack-privatefinalstatic int WEEK_OF_MONTH_MASK = "16" [Inherited From Calendar]
publicfinalstatic int WEEK_OF_YEAR = "3" [Inherited From Calendar]
  Field number for get and set indicating the week number within the current year.
pack-privatefinalstatic int WEEK_OF_YEAR_MASK = "8" [Inherited From Calendar]
publicfinalstatic int YEAR = "1" [Inherited From Calendar]
  Field number for get and set indicating the year.
pack-privatefinalstatic int YEAR_MASK = "2" [Inherited From Calendar]
publicfinalstatic int ZONE_OFFSET = "15" [Inherited From Calendar]
  Field number for get and set indicating the raw offset from GMT in milliseconds.
pack-privatefinalstatic int ZONE_OFFSET_MASK = "32768" [Inherited From Calendar]
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar