GregorianCalendar (Java SE 25 & JDK 25)
- All Implemented Interfaces:
Serializable, Cloneable, Comparable<Calendar>
-
Nested Class Summary
-
Field Summary
Fields
static final intValue of the
ERAfield indicating the common era (Anno Domini), also known as CE.static final intValue of the
ERAfield 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 -
Constructor Summary
Constructors
Constructs a default
GregorianCalendarusing the current time in the default time zone with the defaultFORMATlocale.GregorianCalendar(int year, int month, int dayOfMonth) Constructs a
GregorianCalendarwith 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
GregorianCalendarwith 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
GregorianCalendarbased on the current time in the default time zone with the given locale.Constructs a
GregorianCalendarbased on the current time in the given time zone with the defaultFORMATlocale.Constructs a
GregorianCalendarbased on the current time in the given time zone with the given locale. -
Method Summary
voidadd(int field, int amount) Adds the specified (signed) amount of time to the given calendar field, based on the calendar's rules.
protected voidConverts the time value (millisecond offset from the Epoch) to calendar field values.
protected voidConverts calendar field values to the time value (millisecond offset from the Epoch).
booleanCompares this
GregorianCalendarto the specifiedObject.Obtains an instance of
GregorianCalendarwith the default locale from aZonedDateTimeobject.intgetActualMaximum(int field) intgetActualMinimum(int field) Returns
"gregory"as the calendar type.intgetGreatestMinimum(int field) Returns the highest minimum value for the given calendar field of this
GregorianCalendarinstance.Gets the Gregorian Calendar change date.
intgetLeastMaximum(int field) Returns the lowest maximum value for the given calendar field of this
GregorianCalendarinstance.intgetMaximum(int field) Returns the maximum value for the given calendar field of this
GregorianCalendarinstance.intgetMinimum(int field) Returns the minimum value for the given calendar field of this
GregorianCalendarinstance.intReturns the number of weeks in the week year represented by this
GregorianCalendar.intReturns the week year represented by this
GregorianCalendar.inthashCode()Generates the hash code for this
GregorianCalendarobject.booleanisLeapYear(int year) Determines if the given year is a leap year.
final booleanReturns
trueindicating thisGregorianCalendarsupports week dates.voidroll(int field, boolean up) Adds or subtracts (up/down) a single unit of time on the given time field without changing larger fields.
voidroll(int field, int amount) Adds a signed amount to the specified calendar field without changing larger fields.
voidSets the
GregorianCalendarchange date.voidsetWeekDate(int weekYear, int weekOfYear, int dayOfWeek) Sets this
GregorianCalendarto the date given by the date specifiers -weekYear,weekOfYear, anddayOfWeek.Converts this object to a
ZonedDateTimethat represents the same point on the time-line as thisGregorianCalendar.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
-
Field Details
-
BC
-
AD
-
-
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
-