All Implemented Interfaces:
Serializable, Cloneable, Comparable<Calendar>
Direct Known Subclasses:
GregorianCalendar

  • Nested Class Summary

    Nested Classes

    static class 

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

  • Field Summary

    Fields

    static final int

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

    static final int

    Value of the 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 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 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 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 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

    Value of the DAY_OF_WEEK field indicating Friday.

    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 MONTH field indicating the first month of the year in the Gregorian and Julian calendars.

    static final int

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

    static final int

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

    static final int

    A style specifier for getDisplayName and getDisplayNames equivalent to LONG_FORMAT.

    static final int

    A style specifier for getDisplayName and getDisplayNames indicating a long name used for format.

    static final int

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

    static final int

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

    static final int

    Value of the 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

    Value of the DAY_OF_WEEK field indicating Monday.

    static final int

    Field number for get and set indicating the month.

    static final int

    A style specifier for getDisplayName and getDisplayNames indicating a narrow name used for format.

    static final int

    A style specifier for getDisplayName and getDisplayNames indicating a narrow name independently.

    static final int

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

    static final int

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

    static final int

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

    static final int

    Value of the DAY_OF_WEEK field indicating Saturday.

    static final int

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

    static final int

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

    static final int

    A style specifier for getDisplayName and getDisplayNames equivalent to SHORT_FORMAT.

    static final int

    A style specifier for getDisplayName and getDisplayNames indicating a short name used for format.

    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

    Value of the DAY_OF_WEEK field indicating Sunday.

    static final int

    Value of the DAY_OF_WEEK field indicating Thursday.

    protected long

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

    static final int

    Value of the DAY_OF_WEEK field indicating Tuesday.

    static final int

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

    static final int

    Value of the DAY_OF_WEEK field indicating Wednesday.

    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

    protected

    Calendar()

    Constructs a Calendar with the default time zone and the default FORMAT locale.

    protected

    Constructs a calendar with the specified time zone and locale.

  • Method Summary

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

    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

    clear()

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

    final void

    clear(int field)

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

    clone()

    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

    complete()

    Fills in any unset fields in the calendar fields.

    protected abstract void

    Converts the current millisecond time value time to calendar field values in fields[].

    protected abstract void

    Converts the current calendar field values in fields[] to the millisecond time value time.

    boolean

    Compares this Calendar to the specified Object.

    int

    get(int field)

    Returns the value of the given calendar field.

    int

    getActualMaximum(int field)

    Returns the maximum value that the specified calendar field could have, given the time value of this Calendar.

    int

    getActualMinimum(int field)

    Returns the minimum value that the specified calendar field could have, given the time value of this Calendar.

    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 calendar type of this Calendar.

    getDisplayName(int field, int style, Locale locale)

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

    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.

    int

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

    abstract int

    getGreatestMinimum(int field)

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

    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.

    abstract int

    getLeastMaximum(int field)

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

    abstract int

    getMaximum(int field)

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

    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.

    abstract int

    getMinimum(int field)

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

    getTime()

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

    long

    Returns this Calendar's time value in milliseconds.

    int

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

    int

    Returns the week year represented by this Calendar.

    int

    hashCode()

    Returns a hash code for this calendar.

    protected final int

    internalGet(int field)

    Returns the value of the given calendar field.

    boolean

    isLenient()

    Tells whether date/time interpretation is to be lenient.

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

    boolean

    Returns whether this Calendar supports week dates.

    abstract 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 the specified (signed) amount to the specified calendar field without changing larger fields.

    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

    setFirstDayOfWeek(int value)

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

    void

    setLenient(boolean lenient)

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

    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.

    final void

    Sets this Calendar's time with the given Date.

    void

    setTimeInMillis(long millis)

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

    void

    Sets the time zone with the given time zone value.

    void

    setWeekDate(int weekYear, int weekOfYear, int dayOfWeek)

    Sets the date of this Calendar with the given date specifiers - week year, week of year, and day of week.

    toInstant()

    Converts this object to an Instant.

    toString()

    Return a string representation of this calendar.

  • Field Details

    • ERA

    • YEAR

    • MONTH

    • WEEK_OF_YEAR

    • WEEK_OF_MONTH

    • DATE

    • DAY_OF_MONTH

    • DAY_OF_YEAR

    • DAY_OF_WEEK

    • DAY_OF_WEEK_IN_MONTH

    • AM_PM

    • HOUR

    • HOUR_OF_DAY

    • MINUTE

    • SECOND

    • MILLISECOND

    • ZONE_OFFSET

    • DST_OFFSET

    • FIELD_COUNT

    • SUNDAY

    • MONDAY

    • TUESDAY

    • WEDNESDAY

    • THURSDAY

    • FRIDAY

    • SATURDAY

    • JANUARY

    • FEBRUARY

    • MARCH

    • APRIL

    • MAY

    • JUNE

    • JULY

    • AUGUST

    • SEPTEMBER

    • OCTOBER

    • NOVEMBER

    • DECEMBER

    • UNDECIMBER

    • AM

    • PM

    • ALL_STYLES

    • SHORT

    • LONG

    • NARROW_FORMAT

    • NARROW_STANDALONE

    • SHORT_FORMAT

    • LONG_FORMAT

    • SHORT_STANDALONE

    • LONG_STANDALONE

    • fields

    • isSet

    • time

    • isTimeSet

    • areFieldsSet

  • Constructor Details

    • Calendar

    • Calendar

  • Method Details

    • getInstance

    • getInstance

    • getInstance

    • getInstance

    • getAvailableLocales

    • computeTime

    • computeFields

    • getTime

    • setTime

    • getTimeInMillis

    • setTimeInMillis

    • get

    • internalGet

    • set

    • set

    • set

    • set

    • clear

    • clear

    • isSet

    • getDisplayName

    • getDisplayNames

    • complete

    • getAvailableCalendarTypes

    • getCalendarType

    • equals

    • hashCode

    • before

    • after

    • compareTo

    • add

    • roll

    • roll

    • setTimeZone

    • getTimeZone

    • setLenient

    • isLenient

    • setFirstDayOfWeek

    • getFirstDayOfWeek

    • setMinimalDaysInFirstWeek

    • getMinimalDaysInFirstWeek

    • isWeekDateSupported

    • getWeekYear

    • setWeekDate

    • getWeeksInWeekYear

    • getMinimum

    • getMaximum

    • getGreatestMinimum

    • getLeastMaximum

    • getActualMinimum

    • getActualMaximum

    • clone

    • toString

    • toInstant