Top Description Fields Constructors Methods
java.util

public Class GregorianCalendar

extends Calendar
Class Inheritance
Known Direct Subclasses
sun.util.BuddhistCalendar
Imports
java.io.IOException, .ObjectInputStream, java.time.Instant, .ZonedDateTime, java.time.temporal.ChronoField, sun.util.calendar.BaseCalendar, .CalendarDate, .CalendarSystem, .CalendarUtils, .Era, .Gregorian, .JulianCalendar, .ZoneInfo

GregorianCalendar is a concrete subclass of Calendar and provides the standard calendar system used by most of the world.

GregorianCalendar is a hybrid calendar that supports both the Julian and Gregorian calendar systems with the support of a single discontinuity, which corresponds by default to the Gregorian date when the Gregorian calendar was instituted (October 15, 1582 in some countries, later in others). The cutover date may be changed by the caller by calling setGregorianChange().

Historically, in those countries which adopted the Gregorian calendar first, October 4, 1582 (Julian) was thus followed by October 15, 1582 (Gregorian). This calendar models this correctly. Before the Gregorian cutover, GregorianCalendar implements the Julian calendar. The only difference between the Gregorian and the Julian calendar is the leap year rule. The Julian calendar specifies leap years every four years, whereas the Gregorian calendar omits century years which are not divisible by 400.

GregorianCalendar implements proleptic Gregorian and Julian calendars. That is, dates are computed by extrapolating the current rules indefinitely far backward and forward in time. As a result, GregorianCalendar may be used for all years to generate meaningful and consistent results. However, dates obtained using GregorianCalendar are historically accurate only from March 1, 4 AD onward, when modern Julian calendar rules were adopted. Before this date, leap year rules were applied irregularly, and before 45 BC the Julian calendar did not even exist.

Prior to the institution of the Gregorian calendar, New Year's Day was March 25. To avoid confusion, this calendar always uses January 1. A manual adjustment may be made if desired for dates that are prior to the Gregorian changeover and which fall between January 1 and March 24.

Week Of Year and Week Year

Values calculated for the WEEK_OF_YEAR field range from 1 to 53. The first week of a calendar year is the earliest seven day period starting on getFirstDayOfWeek() that contains at least getMinimalDaysInFirstWeek() days from that year. It thus depends on the values of getMinimalDaysInFirstWeek(), getFirstDayOfWeek(), and the day of the week of January 1. Weeks between week 1 of one year and week 1 of the following year (exclusive) are numbered sequentially from 2 to 52 or 53 (except for year(s) involved in the Julian-Gregorian transition).

The getFirstDayOfWeek() and getMinimalDaysInFirstWeek() values are initialized using locale-dependent resources when constructing a GregorianCalendar. The week determination is compatible with the ISO 8601 standard when getFirstDayOfWeek() is MONDAY and getMinimalDaysInFirstWeek() is 4, which values are used in locales where the standard is preferred. These values can explicitly be set by calling setFirstDayOfWeek() and setMinimalDaysInFirstWeek().

A week year is in sync with a WEEK_OF_YEAR cycle. All weeks between the first and last weeks (inclusive) have the same week year value. Therefore, the first and last days of a week year may have different calendar year values.

For example, January 1, 1998 is a Thursday. If getFirstDayOfWeek() is MONDAY and getMinimalDaysInFirstWeek() is 4 (ISO 8601 standard compatible setting), then week 1 of 1998 starts on December 29, 1997, and ends on January 4, 1998. The week year is 1998 for the last three days of calendar year 1997. If, however, getFirstDayOfWeek() is SUNDAY, then week 1 of 1998 starts on January 4, 1998, and ends on January 10, 1998; the first three days of 1998 then are part of week 53 of 1997 and their week year is 1997.

Week Of Month

Values calculated for the WEEK_OF_MONTH field range from 0 to 6. Week 1 of a month (the days with WEEK_OF_MONTH = 1) is the earliest set of at least getMinimalDaysInFirstWeek() contiguous days in that month, ending on the day before getFirstDayOfWeek(). Unlike week 1 of a year, week 1 of a month may be shorter than 7 days, need not start on getFirstDayOfWeek(), and will not include days of the previous month. Days of a month before week 1 have a WEEK_OF_MONTH of 0.

For example, if getFirstDayOfWeek() is SUNDAY and getMinimalDaysInFirstWeek() is 4, then the first week of January 1998 is Sunday, January 4 through Saturday, January 10. These days have a WEEK_OF_MONTH of 1. Thursday, January 1 through Saturday, January 3 have a WEEK_OF_MONTH of 0. If getMinimalDaysInFirstWeek() is changed to 3, then January 1 through January 3 have a WEEK_OF_MONTH of 1.

Default Fields Values

The clear method sets calendar field(s) undefined. GregorianCalendar uses the following default value for each calendar field if its value is undefined.

GregorianCalendar default field values
Field Default Value
ERA AD
YEAR 1970
MONTH JANUARY
DAY_OF_MONTH 1
DAY_OF_WEEK the first day of week
WEEK_OF_MONTH 0
DAY_OF_WEEK_IN_MONTH 1
AM_PM AM
HOUR, HOUR_OF_DAY, MINUTE, SECOND, MILLISECOND 0

Default values are not applicable for the fields not listed above.

Example:

// get the supported ids for GMT-08:00 (Pacific Standard Time)
String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
// if no ids were returned, something is wrong. get out.
if (ids.length == 0)
    System.exit(0);

 // begin output
System.out.println("Current Time");

// create a Pacific Standard Time time zone
SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);

// set up rules for Daylight Saving Time
pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);

// create a GregorianCalendar with the Pacific Daylight time zone
// and the current date and time
Calendar calendar = new GregorianCalendar(pdt);
Date trialTime = new Date();
calendar.setTime(trialTime);

// print out a bunch of interesting things
System.out.println("ERA: " + calendar.get(Calendar.ERA));
System.out.println("YEAR: " + calendar.get(Calendar.YEAR));
System.out.println("MONTH: " + calendar.get(Calendar.MONTH));
System.out.println("WEEK_OF_YEAR: " + calendar.get(Calendar.WEEK_OF_YEAR));
System.out.println("WEEK_OF_MONTH: " + calendar.get(Calendar.WEEK_OF_MONTH));
System.out.println("DATE: " + calendar.get(Calendar.DATE));
System.out.println("DAY_OF_MONTH: " + calendar.get(Calendar.DAY_OF_MONTH));
System.out.println("DAY_OF_YEAR: " + calendar.get(Calendar.DAY_OF_YEAR));
System.out.println("DAY_OF_WEEK: " + calendar.get(Calendar.DAY_OF_WEEK));
System.out.println("DAY_OF_WEEK_IN_MONTH: "
                   + calendar.get(Calendar.DAY_OF_WEEK_IN_MONTH));
System.out.println("AM_PM: " + calendar.get(Calendar.AM_PM));
System.out.println("HOUR: " + calendar.get(Calendar.HOUR));
System.out.println("HOUR_OF_DAY: " + calendar.get(Calendar.HOUR_OF_DAY));
System.out.println("MINUTE: " + calendar.get(Calendar.MINUTE));
System.out.println("SECOND: " + calendar.get(Calendar.SECOND));
System.out.println("MILLISECOND: " + calendar.get(Calendar.MILLISECOND));
System.out.println("ZONE_OFFSET: "
                   + (calendar.get(Calendar.ZONE_OFFSET)/(60*60*1000)));
System.out.println("DST_OFFSET: "
                   + (calendar.get(Calendar.DST_OFFSET)/(60*60*1000)));
System.out.println("Current Time, with hour reset to 3");
calendar.clear(Calendar.HOUR_OF_DAY); // so doesn't override
calendar.set(Calendar.HOUR, 3);
System.out.println("ERA: " + calendar.get(Calendar.ERA));
System.out.println("YEAR: " + calendar.get(Calendar.YEAR));
System.out.println("MONTH: " + calendar.get(Calendar.MONTH));
System.out.println("WEEK_OF_YEAR: " + calendar.get(Calendar.WEEK_OF_YEAR));
System.out.println("WEEK_OF_MONTH: " + calendar.get(Calendar.WEEK_OF_MONTH));
System.out.println("DATE: " + calendar.get(Calendar.DATE));
System.out.println("DAY_OF_MONTH: " + calendar.get(Calendar.DAY_OF_MONTH));
System.out.println("DAY_OF_YEAR: " + calendar.get(Calendar.DAY_OF_YEAR));
System.out.println("DAY_OF_WEEK: " + calendar.get(Calendar.DAY_OF_WEEK));
System.out.println("DAY_OF_WEEK_IN_MONTH: "
                   + calendar.get(Calendar.DAY_OF_WEEK_IN_MONTH));
System.out.println("AM_PM: " + calendar.get(Calendar.AM_PM));
System.out.println("HOUR: " + calendar.get(Calendar.HOUR));
System.out.println("HOUR_OF_DAY: " + calendar.get(Calendar.HOUR_OF_DAY));
System.out.println("MINUTE: " + calendar.get(Calendar.MINUTE));
System.out.println("SECOND: " + calendar.get(Calendar.SECOND));
System.out.println("MILLISECOND: " + calendar.get(Calendar.MILLISECOND));
System.out.println("ZONE_OFFSET: "
       + (calendar.get(Calendar.ZONE_OFFSET)/(60*60*1000))); // in hours
System.out.println("DST_OFFSET: "
       + (calendar.get(Calendar.DST_OFFSET)/(60*60*1000))); // in hours
Author
David Goldsmith, Mark Davis, Chen-Lieh Huang, Alan Liu
Since
1.1
See Also
TimeZone

Field Summary

Modifier and TypeField and Description
public static final int
AD

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

public static final int
BC

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

pack-priv static final int
BCE

Value of the ERA field indicating the period before the common era, the same value as BC.

private transient long
cachedFixedDate

The fixed date corresponding to gdate.

private transient BaseCalendar
calsys

The CalendarSystem used to calculate the date in cdate.

private transient BaseCalendar.Date
cdate

Reference to either gdate or a JulianCalendar.Date instance.

pack-priv static final int
CE

Value of the ERA field indicating the common era, the same value as AD.

pack-priv static final long
private static final int
private static final int
private static final Gregorian
private transient BaseCalendar.Date
gdate

gdate always has a sun.util.calendar.Gregorian.Date instance to avoid overhead of creating it.

private long
gregorianCutover

The point at which the Gregorian calendar rules are used, measured in milliseconds from the standard epoch.

private transient long
gregorianCutoverDate

The fixed date of the gregorianCutover.

private transient int
gregorianCutoverYear

The normalized year of the gregorianCutover in Gregorian, with 0 representing 1 BCE, -1 representing 2 BCE, etc.

private transient int
gregorianCutoverYearJulian

The normalized year of the gregorianCutover in Julian, with 0 representing 1 BCE, -1 representing 2 BCE, etc.

private static JulianCalendar
private static Era[]
pack-priv static final int[]
pack-priv static final int[]
pack-priv static final int[]
pack-priv static final int[]
pack-priv static final int[]
private static final long
private static final int
private static final int
private static final int
private static final long
private transient int[]
originalFields

Temporary storage for saving original fields[] values in non-lenient mode.

pack-priv static final long
private transient int[]
zoneOffsets

Temporary int[2] to get time zone offsets.

Inherited from java.util.Calendar:
ALL_FIELDSALL_STYLESAMAM_PMAM_PM_MASKAPRILareAllFieldsSetareFieldsSetAUGUSTcurrentSerialVersionDATEDAY_OF_MONTHDAY_OF_MONTH_MASKDAY_OF_WEEKDAY_OF_WEEK_IN_MONTHDAY_OF_WEEK_IN_MONTH_MASKDAY_OF_WEEK_MASKDAY_OF_YEARDAY_OF_YEAR_MASKDECEMBERDST_OFFSETDST_OFFSET_MASKERAERA_MASKFEBRUARYFIELD_COUNTfieldsFRIDAYHOURHOUR_MASKHOUR_OF_DAYHOUR_OF_DAY_MASKisSetisTimeSetJANUARYJULYJUNELONGLONG_FORMATLONG_STANDALONEMARCHMAYMILLISECONDMILLISECOND_MASKMINUTEMINUTE_MASKMONDAYMONTHMONTH_MASKNARROW_FORMATNARROW_STANDALONENOVEMBEROCTOBERPMSATURDAYSECONDSECOND_MASKSEPTEMBERSHORTSHORT_FORMATSHORT_STANDALONESTANDALONE_MASKSUNDAYTHURSDAYtimeTUESDAYUNDECIMBERWEDNESDAYWEEK_OF_MONTHWEEK_OF_MONTH_MASKWEEK_OF_YEARWEEK_OF_YEAR_MASKYEARYEAR_MASKZONE_OFFSETZONE_OFFSET_MASK

Constructor Summary

AccessConstructor and Description
public
GregorianCalendar()

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

public
GregorianCalendar(TimeZone
the given time zone.
zone
)

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

public
GregorianCalendar(Locale
the given locale.
aLocale
)

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

public
GregorianCalendar(TimeZone
the given time zone.
zone
,
Locale
the given locale.
aLocale
)

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

public
GregorianCalendar(int
the value used to set the YEAR calendar field in the calendar.
year
,
int
the value used to set the MONTH calendar field in the calendar. Month value is 0-based. e.g., 0 for January.
month
,
int
the value used to set the DAY_OF_MONTH calendar field in the calendar.
dayOfMonth
)

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

public
GregorianCalendar(int
the value used to set the YEAR calendar field in the calendar.
year
,
int
the value used to set the MONTH calendar field in the calendar. Month value is 0-based. e.g., 0 for January.
month
,
int
the value used to set the DAY_OF_MONTH calendar field in the calendar.
dayOfMonth
,
int
the value used to set the HOUR_OF_DAY calendar field in the calendar.
hourOfDay
,
int
the value used to set the MINUTE calendar field in the calendar.
minute
)

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

public
GregorianCalendar(int
the value used to set the YEAR calendar field in the calendar.
year
,
int
the value used to set the MONTH calendar field in the calendar. Month value is 0-based. e.g., 0 for January.
month
,
int
the value used to set the DAY_OF_MONTH calendar field in the calendar.
dayOfMonth
,
int
the value used to set the HOUR_OF_DAY calendar field in the calendar.
hourOfDay
,
int
the value used to set the MINUTE calendar field in the calendar.
minute
,
int
the value used to set the SECOND calendar field in the calendar.
second
)

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

pack-priv
GregorianCalendar(int
the value used to set the YEAR calendar field in the calendar.
year
,
int
the value used to set the MONTH calendar field in the calendar. Month value is 0-based. e.g., 0 for January.
month
,
int
the value used to set the DAY_OF_MONTH calendar field in the calendar.
dayOfMonth
,
int
the value used to set the HOUR_OF_DAY calendar field in the calendar.
hourOfDay
,
int
the value used to set the MINUTE calendar field in the calendar.
minute
,
int
the value used to set the SECOND calendar field in the calendar.
second
,
int
the value used to set the MILLISECOND calendar field
millis
)

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

pack-priv
GregorianCalendar(TimeZone
the given time zone
zone
,
Locale
the given locale
locale
,
boolean
the flag requesting an empty instance
flag
)

Constructs an empty GregorianCalendar.

Method Summary

Modifier and TypeMethod and Description
private int
public void
add(int
the calendar field.
field
,
int
the amount of date or time to be added to the field.
amount
)

Implements abstract java.util.Calendar.add.

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

public Object
clone()

Overrides java.util.Calendar.clone.

Creates and returns a copy of this object.

protected void
computeFields()

Implements abstract java.util.Calendar.computeFields.

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

private int

Returns:

a new field mask that indicates what field values have actually been set.
computeFields
(int
a bit mask to specify which fields to change the setting state.
fieldMask
,
int
a bit mask to specify which time zone offset fields to be used for time calculations
tzMask
)

This computeFields implements the conversion from UTC (millisecond offset from the Epoch) to calendar field values.

protected void
computeTime()

Implements abstract java.util.Calendar.computeTime.

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

private boolean
dayInMinWeek(int day, int startDay, int endDay)

Given the first day and last day of a week, this method determines if the specified day exists in the minimum week.

public boolean

Returns:

true if this object is equal to obj; false otherwise.
equals
(Object
the object to compare with.
obj
)

Overrides java.util.Calendar.equals.

Compares this GregorianCalendar to the specified Object.

public static GregorianCalendar

Returns:

the gregorian calendar representing the same point on the time-line as the zoned date-time provided
from
(ZonedDateTime
the zoned date-time object to convert
zdt
)

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

public int

Returns:

the maximum of the given field for the time value of this GregorianCalendar
getActualMaximum
(int
the calendar field
field
)

Overrides java.util.Calendar.getActualMaximum.

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

Returns:

the minimum of the given field for the time value of this GregorianCalendar
getActualMinimum
(int
the calendar field
field
)

Overrides java.util.Calendar.getActualMinimum.

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.

private BaseCalendar.Date
getCalendarDate(long
the fixed date
fd
)

Returns a CalendarDate produced from the specified fixed date.

public String

Returns:

"gregory"
getCalendarType
()

Overrides java.util.Calendar.getCalendarType.

Returns "gregory" as the calendar type.

private long
getCurrentFixedDate()

Returns the fixed date value of this object.

private BaseCalendar
getCutoverCalendarSystem()

Returns the calendar system for dates before the cutover date in the cutover year.

private long

Returns:

the fixed date
getFixedDate
(BaseCalendar
the CalendarSystem to be used for the date calculation
cal
,
int
the normalized year number, with 0 indicating the year 1 BCE, -1 indicating 2 BCE, etc.
year
,
int
the calendar fields to be used for the date calculation
fieldMask
)

Computes the fixed date under either the Gregorian or the Julian calendar, using the given year and the specified calendar fields.

private long
getFixedDateJan1(BaseCalendar.Date
the date for which the first day of the year is calculated. The date has to be in the cut-over year (Gregorian or Julian).
date
,
long
the fixed date representation of the date
fixedDate
)

Returns the fixed date of the first day of the year (usually January 1) before the specified date.

private long
getFixedDateMonth1(BaseCalendar.Date
the date for which the first day of the month is calculated. The date has to be in the cut-over year (Gregorian or Julian).
date
,
long
the fixed date representation of the date
fixedDate
)

Returns the fixed date of the first date of the month (usually the 1st of the month) before the specified date.

public int

Returns:

the highest minimum value for the given calendar field.
getGreatestMinimum
(int
the calendar field.
field
)

Implements abstract java.util.Calendar.getGreatestMinimum.

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

public final Date

Returns:

the Gregorian cutover date for this GregorianCalendar object.
getGregorianChange
()

Gets the Gregorian Calendar change date.

private BaseCalendar.Date
getGregorianCutoverDate()

Returns the Gregorian cutover date as a BaseCalendar.Date.

private static synchronized BaseCalendar
getJulianCalendarSystem()

Returns the Julian calendar system instance (singleton).

private BaseCalendar.Date
getLastJulianDate()

Returns the day before the Gregorian cutover date as a BaseCalendar.Date.

public int

Returns:

the lowest maximum value for the given calendar field.
getLeastMaximum
(int
the calendar field
field
)

Implements abstract java.util.Calendar.getLeastMaximum.

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

public int

Returns:

the maximum value for the given calendar field.
getMaximum
(int
the calendar field.
field
)

Implements abstract java.util.Calendar.getMaximum.

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

public int

Returns:

the minimum value for the given calendar field.
getMinimum
(int
the calendar field.
field
)

Implements abstract java.util.Calendar.getMinimum.

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

private GregorianCalendar
getNormalizedCalendar()

Returns this object if it's normalized (all fields and time are in sync).

private static int
getRolledValue(int value, int amount, int min, int max)

Returns the new value after 'roll'ing the specified value and amount.

public TimeZone
getTimeZone()

Overrides java.util.Calendar.getTimeZone.

Gets the time zone.

private int

Returns:

the number of weeks of the given period
getWeekNumber
(long
the fixed date of the first day of the period
fixedDay1
,
long
the fixed date of the last day of the period
fixedDate
)

Returns the number of weeks in a period between fixedDay1 and fixedDate.

public int

Returns:

the number of weeks in the week year.
getWeeksInWeekYear
()

Overrides java.util.Calendar.getWeeksInWeekYear.

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

public int

Returns:

the week year represented by this GregorianCalendar. If the ERA value is BC, the year is represented by 0 or a negative number: BC 1 is 0, BC 2 is -1, BC 3 is -2, and so on.
getWeekYear
()

Overrides java.util.Calendar.getWeekYear.

Returns the week year represented by this GregorianCalendar.

private long
getYearOffsetInMillis()

Returns the millisecond offset from the beginning of this year.

public int
hashCode()

Overrides java.util.Calendar.hashCode.

Generates the hash code for this GregorianCalendar object.

private int
internalGetEra()

Returns the ERA.

private boolean
isCutoverYear(int normalizedYear)

Determines if the specified year (normalized) is the Gregorian cutover year.

private boolean

Returns:

true if the first week of the current year is minimum and the DAY_OF_WEEK does not exist in that week
isInvalidWeek1
()

Returns true if the first week of the current year is minimum and the DAY_OF_WEEK does not exist in that week.

public boolean

Returns:

true if the given year is a leap year; false otherwise.
isLeapYear
(int
the given year.
year
)

Determines if the given year is a leap year.

public final boolean

Returns:

true (always)
isWeekDateSupported
()

Overrides java.util.Calendar.isWeekDateSupported.

Returns true indicating this GregorianCalendar supports week dates.

private int
monthLength(int month, int year)

Returns the length of the specified month in the specified year.

private int
monthLength(int month)

Returns the length of the specified month in the year provided by internalGet(YEAR).

private void
pinDayOfMonth()

After adjustments such as add(MONTH), add(YEAR), we don't want the month to jump around.

private void
readObject(ObjectInputStream stream)

Hides java.util.Calendar.readObject.

Updates internal state.

public void
roll(int
the time field.
field
,
boolean
indicates if the value of the specified calendar field is to be rolled up or rolled down. Use true if rolling up, false otherwise.
up
)

Implements abstract java.util.Calendar.roll.

Adds or subtracts (up/down) a single unit of time on the given time field without changing larger fields.

public void
roll(int
the calendar field.
field
,
int
the signed amount to add to field.
amount
)

Overrides java.util.Calendar.roll.

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

public void
setGregorianChange(Date
the given Gregorian cutover date.
date
)

Sets the GregorianCalendar change date.

private void
setGregorianChange(long cutoverTime)

public void
setTimeZone(TimeZone
the given time zone.
zone
)

Overrides java.util.Calendar.setTimeZone.

Sets the time zone with the given time zone value.

public void
setWeekDate(int
the week year
weekYear
,
int
the week number based on weekYear
weekOfYear
,
int
the day of week value: one of the constants for the DAY_OF_WEEK field: SUNDAY, ..., SATURDAY.
dayOfWeek
)

Overrides java.util.Calendar.setWeekDate.

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

public ZonedDateTime

Returns:

a zoned date-time representing the same point on the time-line as this gregorian calendar
toZonedDateTime
()

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

private int
yearLength(int year)

Returns the length (in days) of the specified year.

private int
yearLength()

Returns the length (in days) of the year provided by internalGet(YEAR).

Inherited from java.util.Calendar:
afterbeforecheckDisplayNameParamsclearclearcompareTocompletegetgetAvailableCalendarTypesgetAvailableLocalesgetBaseStylegetDisplayNamegetDisplayNamesgetFieldNamegetFirstDayOfWeekgetInstancegetInstancegetInstancegetInstancegetMinimalDaysInFirstWeekgetSetStateFieldsgetTimegetTimeInMillisgetZoneinternalGetinternalSetisExternallySetisFieldSetisFullyNormalizedisLenientisPartiallyNormalizedisSetselectFieldssetsetsetsetsetFieldsComputedsetFieldsNormalizedsetFirstDayOfWeeksetLenientsetMinimalDaysInFirstWeeksetTimesetTimeInMillissetUnnormalizedsetZoneSharedtoInstanttoString