All Implemented Interfaces:
Serializable, Cloneable, Comparable<Calendar>

  • Nested Class Summary

    Nested classes/interfaces declared in class Calendar

    Calendar.Builder

    static class 

    Calendar.Builder is used for creating a Calendar from various date-time parameters.

  • Field Summary

    Fields

    static final int

    Value of the ERA field indicating the common era (Anno Domini), also known as CE.

    static final int

    Value of the ERA field indicating the period before the common era (before Christ), also known as BCE.

    Fields declared in class Calendar

    ALL_STYLES, AM, AM_PM, APRIL, areFieldsSet, AUGUST, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DST_OFFSET, ERA, FEBRUARY, FIELD_COUNT, fields, FRIDAY, HOUR, HOUR_OF_DAY, isSet, isTimeSet, JANUARY, JULY, JUNE, LONG, LONG_FORMAT, LONG_STANDALONE, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NARROW_FORMAT, NARROW_STANDALONE, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SHORT, SHORT_FORMAT, SHORT_STANDALONE, SUNDAY, THURSDAY, time, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, YEAR, ZONE_OFFSET

    static final int

    A style specifier for getDisplayNames indicating names in all styles, such as "January" and "Jan".

    static final int

    Value of the Calendar.AM_PM field indicating the period of the day from midnight to just before noon.

    static final int

    Field number for get and set indicating whether the HOUR is before or after noon.

    static final int

    Value of the Calendar.MONTH field indicating the fourth month of the year in the Gregorian and Julian calendars.

    protected boolean

    True if fields[] are in sync with the currently set time.

    static final int

    Value of the Calendar.MONTH field indicating the eighth month of the year in the Gregorian and Julian calendars.

    static final int

    Field number for get and set indicating the day of the month.

    static final int

    Field number for get and set indicating the day of the month.

    static final int

    Field number for get and set indicating the day of the week.

    static final int

    Field number for get and set indicating the ordinal number of the day of the week within the current month.

    static final int

    Field number for get and set indicating the day number within the current year.

    static final int

    Value of the Calendar.MONTH field indicating the twelfth month of the year in the Gregorian and Julian calendars.

    static final int

    Field number for get and set indicating the daylight saving offset in milliseconds.

    static final int

    Field number for get and set indicating the era, e.g., AD or BC in the Julian calendar.

    static final int

    Value of the Calendar.MONTH field indicating the second month of the year in the Gregorian and Julian calendars.

    static final int

    The number of distinct fields recognized by get and set.

    protected int[]

    The calendar field values for the currently set time for this calendar.

    static final int

    static final int

    Field number for get and set indicating the hour of the morning or afternoon.

    static final int

    Field number for get and set indicating the hour of the day.

    protected boolean[]

    The flags which tell if a specified calendar field for the calendar is set.

    protected boolean

    True if then the value of time is valid.

    static final int

    Value of the Calendar.MONTH field indicating the first month of the year in the Gregorian and Julian calendars.

    static final int

    Value of the Calendar.MONTH field indicating the seventh month of the year in the Gregorian and Julian calendars.

    static final int

    Value of the Calendar.MONTH field indicating the sixth month of the year in the Gregorian and Julian calendars.

    static final int

    static final int

    static final int

    static final int

    Value of the Calendar.MONTH field indicating the third month of the year in the Gregorian and Julian calendars.

    static final int

    Value of the Calendar.MONTH field indicating the fifth month of the year in the Gregorian and Julian calendars.

    static final int

    Field number for get and set indicating the millisecond within the second.

    static final int

    Field number for get and set indicating the minute within the hour.

    static final int

    static final int

    Field number for get and set indicating the month.

    static final int

    static final int

    static final int

    Value of the Calendar.MONTH field indicating the eleventh month of the year in the Gregorian and Julian calendars.

    static final int

    Value of the Calendar.MONTH field indicating the tenth month of the year in the Gregorian and Julian calendars.

    static final int

    Value of the Calendar.AM_PM field indicating the period of the day from noon to just before midnight.

    static final int

    static final int

    Field number for get and set indicating the second within the minute.

    static final int

    Value of the Calendar.MONTH field indicating the ninth month of the year in the Gregorian and Julian calendars.

    static final int

    static final int

    static final int

    A style specifier for getDisplayName and getDisplayNames indicating a short name used independently, such as a month abbreviation as calendar headers.

    static final int

    static final int

    protected long

    The currently set time for this calendar, expressed in milliseconds after January 1, 1970, 0:00:00 GMT.

    static final int

    static final int

    Value of the Calendar.MONTH field indicating the thirteenth month of the year.

    static final int

    static final int

    Field number for get and set indicating the week number within the current month.

    static final int

    Field number for get and set indicating the week number within the current year.

    static final int

    Field number for get and set indicating the year.

    static final int

    Field number for get and set indicating the raw offset from GMT in milliseconds.

  • Constructor Summary

    Constructors

    Constructs a default GregorianCalendar using the current time in the default time zone with the default FORMAT locale.

    GregorianCalendar(int year, int month, int dayOfMonth)

    Constructs a GregorianCalendar with the given date set in the default time zone with the default locale.

    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.

    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.

    Constructs a GregorianCalendar based on the current time in the default time zone with the given locale.

    Constructs a GregorianCalendar based on the current time in the given time zone with the default FORMAT locale.

    Constructs a GregorianCalendar based on the current time in the given time zone with the given locale.

  • Method Summary

    void

    add(int field, int amount)

    Adds the specified (signed) amount of time to the given calendar field, based on the calendar's rules.

    protected void

    Converts the time value (millisecond offset from the Epoch) to calendar field values.

    protected void

    Converts calendar field values to the time value (millisecond offset from the Epoch).

    boolean

    Compares this GregorianCalendar to the specified Object.

    Obtains an instance of GregorianCalendar with the default locale from a ZonedDateTime object.

    int

    getActualMaximum(int field)

    int

    getActualMinimum(int field)

    Returns "gregory" as the calendar type.

    int

    getGreatestMinimum(int field)

    Returns the highest minimum value for the given calendar field of this GregorianCalendar instance.

    Gets the Gregorian Calendar change date.

    int

    getLeastMaximum(int field)

    Returns the lowest maximum value for the given calendar field of this GregorianCalendar instance.

    int

    getMaximum(int field)

    Returns the maximum value for the given calendar field of this GregorianCalendar instance.

    int

    getMinimum(int field)

    Returns the minimum value for the given calendar field of this GregorianCalendar instance.

    int

    Returns the number of weeks in the week year represented by this GregorianCalendar.

    int

    Returns the week year represented by this GregorianCalendar.

    int

    hashCode()

    Generates the hash code for this GregorianCalendar object.

    boolean

    isLeapYear(int year)

    Determines if the given year is a leap year.

    final boolean

    Returns true indicating this GregorianCalendar supports week dates.

    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.

    void

    roll(int field, int amount)

    Adds a signed amount to the specified calendar field without changing larger fields.

    void

    Sets the GregorianCalendar change date.

    void

    setWeekDate(int weekYear, int weekOfYear, int dayOfWeek)

    Sets this GregorianCalendar to the date given by the date specifiers - weekYear, weekOfYear, and dayOfWeek.

    Converts this object to a ZonedDateTime that represents the same point on the time-line as this GregorianCalendar.

    Methods declared in class Calendar

    after, before, clear, clear, clone, compareTo, complete, get, getAvailableCalendarTypes, getAvailableLocales, getDisplayName, getDisplayNames, getFirstDayOfWeek, getInstance, getInstance, getInstance, getInstance, getMinimalDaysInFirstWeek, getTime, getTimeInMillis, getTimeZone, internalGet, isLenient, isSet, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setTime, setTimeInMillis, setTimeZone, toInstant, toString

    boolean

    Returns whether this Calendar represents a time after the time represented by the specified Object.

    boolean

    Returns whether this Calendar represents a time before the time represented by the specified Object.

    final void

    Sets all the calendar field values and the time value (millisecond offset from the Epoch) of this Calendar undefined.

    final void

    Sets the given calendar field value and the time value (millisecond offset from the Epoch) of this Calendar undefined.

    Creates and returns a copy of this object.

    int

    Compares the time values (millisecond offsets from the Epoch) represented by two Calendar objects.

    protected void

    Fills in any unset fields in the calendar fields.

    int

    get(int field)

    Returns the value of the given calendar field.

    Returns an unmodifiable Set containing all calendar types supported by Calendar in the runtime environment.

    Returns an array of all locales for which the getInstance methods of this class can return localized instances.

    Returns the string representation of the calendar field value in the given style and locale.

    Returns a Map containing all names of the calendar field in the given style and locale and their corresponding field values.

    int

    Gets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France.

    Gets a calendar using the default time zone and locale.

    Gets a calendar using the default time zone and specified locale.

    Gets a calendar using the specified time zone and default locale.

    Gets a calendar with the specified time zone and locale.

    int

    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.

    Returns a Date object representing this Calendar's time value (millisecond offset from the Epoch").

    long

    Returns this Calendar's time value in milliseconds.

    protected final int

    Returns the value of the given calendar field.

    boolean

    Tells whether date/time interpretation is to be lenient.

    final boolean

    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.

    void

    set(int field, int value)

    Sets the given calendar field to the given value.

    final void

    set(int year, int month, int date)

    Sets the values for the calendar fields YEAR, MONTH, and DAY_OF_MONTH.

    final 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.

    final 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_OF_DAY, MINUTE, and SECOND.

    void

    Sets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France.

    void

    Specifies whether or not date/time interpretation is to be lenient.

    void

    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.

    final void

    Sets this Calendar's time with the given Date.

    void

    Sets this Calendar's current time from the given long value.

    void

    Sets the time zone with the given time zone value.

    Converts this object to an Instant.

    Return a string representation of this calendar.

    Methods declared in class Object

    finalize, getClass, notify, notifyAll, wait, wait, wait

    protected void

    Deprecated, for removal: This API element is subject to removal in a future version.

    Returns the runtime class of this Object.

    final void

    Wakes up a single thread that is waiting on this object's monitor.

    final void

    Wakes up all threads that are waiting on this object's monitor.

    final void

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

    final void

    wait(long timeoutMillis)

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

    final void

    wait(long timeoutMillis, int nanos)

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

  • Field Details

    • BC

  • Constructor Details

    • GregorianCalendar

    • GregorianCalendar

    • GregorianCalendar

    • GregorianCalendar

    • GregorianCalendar

    • GregorianCalendar

    • GregorianCalendar

  • Method Details

    • setGregorianChange

    • getGregorianChange

    • isLeapYear

    • getCalendarType

    • equals

    • hashCode

    • add

    • roll

    • roll

    • getMinimum

    • getMaximum

    • getGreatestMinimum

    • getLeastMaximum

    • getActualMinimum

    • getActualMaximum

    • isWeekDateSupported

    • getWeekYear

    • setWeekDate

    • getWeeksInWeekYear

    • computeFields

    • computeTime

    • toZonedDateTime

    • from