Top Description Fields Constructors Methods
com.ibm.icu.util

public Class HebrewCalendar

extends Calendar
Class Inheritance
Imports
java.util.Date, .Locale, com.ibm.icu.impl.CalendarCache, com.ibm.icu.util.ULocale.Category

HebrewCalendar is a subclass of Calendar that that implements the traditional Hebrew calendar. This is the civil calendar in Israel and the liturgical calendar of the Jewish faith worldwide.

The Hebrew calendar is lunisolar and thus has a number of interesting properties that distinguish it from the Gregorian. Months start on the day of (an arithmetic approximation of) each new moon. Since the solar year (approximately 365.24 days) is not an even multiple of the lunar month (approximately 29.53 days) an extra "leap month" is inserted in 7 out of every 19 years. To make matters even more interesting, the start of a year can be delayed by up to three days in order to prevent certain holidays from falling on the Sabbath and to prevent certain illegal year lengths. Finally, the lengths of certain months can vary depending on the number of days in the year.

The leap month is known as "Adar 1" and is inserted between the months of Shevat and Adar in leap years. Since the leap month does not come at the end of the year, calculations involving month numbers are particularly complex. Users of this class should make sure to use the roll and add methods rather than attempting to perform date arithmetic by manipulating the fields directly.

Note

In the traditional Hebrew calendar, days start at sunset. However, in order to keep the time fields in this class synchronized with those of the other calendars and with local clock time, we treat days and months as beginning at midnight, roughly 6 hours after the corresponding sunset.

If you are interested in more information on the rules behind the Hebrew calendar, see one of the following references:

This class should not be subclassed.

HebrewCalendar usually should be instantiated using com.ibm.icu.util.Calendar#getInstance(ULocale) passing in a ULocale with the tag "@calendar=hebrew".

Authors
Laura Werner, Alan Liu
ICU Status
Stable since ICU 2.8.
See Also
com.ibm.icu.util.GregorianCalendar, com.ibm.icu.util.Calendar

Field Summary

Modifier and TypeField and Description
public static final int
ADAR

Constant for the Adar, the 7th month of the Hebrew year.

public static final int
ADAR_1

Constant for Adar I, the 6th month of the Hebrew year (present in leap years only).

public static final int
AV

Constant for Av, the 12th month of the Hebrew year.

private static final long
private static CalendarCache
private static final long
public static final int
ELUL

Constant for Elul, the 13th month of the Hebrew year.

private static String[]
public static final int
HESHVAN

Constant for Heshvan, the 2nd month of the Hebrew year.

private static final long
public static final int
IYAR

Constant for Iyar, the 9th month of the Hebrew year.

public static final int
KISLEV

Constant for Kislev, the 3rd month of the Hebrew year.

private static final int[][]
LEAP_MONTH_START

The cumulative # of days to the end of each month in a leap year

private static final int[][]
LIMITS

Hides com.ibm.icu.util.Calendar.LIMITS.

The absolute date, in milliseconds since 1/1/1970 AD, Gregorian, of the start of the Hebrew calendar.
private static final int
private static final long
private static final int[][]
MONTH_LENGTH

The lengths of the Hebrew months.

private static final long
private static final int[][]
MONTH_START

The cumulative # of days to the end of each month in a non-leap year Although this can be calculated from the MONTH_LENGTH table, keeping it around separately makes some calculations a lot faster

public static final int
NISAN

Constant for Nisan, the 8th month of the Hebrew year.

private static final long
public static final int
SHEVAT

Constant for Shevat, the 5th month of the Hebrew year.

public static final int
SIVAN

Constant for Sivan, the 10th month of the Hebrew year.

public static final int
TAMUZ

Constant for Tammuz, the 11th month of the Hebrew year.

public static final int
TEVET

Constant for Tevet, the 4th month of the Hebrew year.

public static final int
TISHRI

Constant for Tishri, the 1st month of the Hebrew year.

Inherited from com.ibm.icu.util.Calendar:
AMAM_PMAPRILAUGUSTBASE_FIELD_COUNTDATEDATE_PRECEDENCEDAY_OF_MONTHDAY_OF_WEEKDAY_OF_WEEK_IN_MONTHDAY_OF_YEARDECEMBERDOW_LOCALDOW_PRECEDENCEDST_OFFSETEPOCH_JULIAN_DAYERAEXTENDED_YEARFEBRUARYFRIDAYGREATEST_MINIMUMHOURHOUR_OF_DAYINTERNALLY_SETIS_LEAP_MONTHJAN_1_1_JULIAN_DAYJANUARYJULIAN_DAYJULYJUNELEAST_MAXIMUMMARCHMAX_DATEMAX_FIELD_COUNTMAX_JULIANMAX_MILLISMAXIMUMMAYMILLISECONDMILLISECONDS_IN_DAYMIN_DATEMIN_JULIANMIN_MILLISMINIMUMMINIMUM_USER_STAMPMINUTEMONDAYMONTHMONTH_PRECEDENCENOVEMBEROCTOBERONE_DAYONE_HOURONE_MINUTEONE_SECONDONE_WEEKORDINAL_MONTHPMRESOLVE_REMAPSATURDAYSECONDSEPTEMBERSUNDAYTHURSDAYTUESDAYUNDECIMBERUNSETWALLTIME_FIRSTWALLTIME_LASTWALLTIME_NEXT_VALIDWEDNESDAYWEEK_OF_MONTHWEEK_OF_YEARWEEKDAYWEEKENDWEEKEND_CEASEWEEKEND_ONSETYEARYEAR_WOYZONE_OFFSET

Constructor Summary

AccessConstructor and Description
public
HebrewCalendar()

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

public
HebrewCalendar(TimeZone
The time zone for the new calendar.
zone
)

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

public
HebrewCalendar(Locale
The locale for the new calendar.
aLocale
)

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

public
HebrewCalendar(ULocale
The locale for the new calendar.
locale
)

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

public
HebrewCalendar(TimeZone
The time zone for the new calendar.
zone
,
Locale
The locale for the new calendar.
aLocale
)

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

public
HebrewCalendar(TimeZone
The time zone for the new calendar.
zone
,
ULocale
The locale for the new calendar.
locale
)

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

public
HebrewCalendar(int
The value used to set the calendar's YEAR time field.
year
,
int
The value used to set the calendar's MONTH time field. The value is 0-based. e.g., 0 for Tishri.
month
,
int
The value used to set the calendar's DATE time field.
date
)

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

public
HebrewCalendar(Date
The date to which the new calendar is set.
date
)

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

public
HebrewCalendar(int
The value used to set the calendar's YEAR time field.
year
,
int
The value used to set the calendar's MONTH time field. The value is 0-based. e.g., 0 for Tishri.
month
,
int
The value used to set the calendar's DATE time field.
date
,
int
The value used to set the calendar's HOUR_OF_DAY time field.
hour
,
int
The value used to set the calendar's MINUTE time field.
minute
,
int
The value used to set the calendar's SECOND time field.
second
)

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

Method Summary

Modifier and TypeMethod and Description
public void
add(int
the time field.
field
,
int
the amount to add to the field.
amount
)

Overrides com.ibm.icu.util.Calendar.add.

Add a signed amount to a specified field, using this calendar's rules.
public String

Returns:

One of 13 possible strings in {"M01".. "M05", "M05L", "M06" .. "M12"}.
getTemporalMonthCode
()

Overrides com.ibm.icu.util.Calendar.getTemporalMonthCode.

Gets The Temporal monthCode value corresponding to the month for the date.
public String
protected void
handleComputeFields(int julianDay)

Overrides com.ibm.icu.util.Calendar.handleComputeFields.

Subclasses may override this method to compute several fields specific to each calendar system.
protected int
handleComputeMonthStart(int
the extended year
eyear
,
int
the zero-based month, or 0 if useMonth is false
month
,
boolean
if false, compute the day before the first day of the given year, otherwise, compute the day before the first day of the given month
useMonth
)

Implements abstract com.ibm.icu.util.Calendar.handleComputeMonthStart.

Return JD of start of given month/year.
protected int
handleGetExtendedYear()

Implements abstract com.ibm.icu.util.Calendar.handleGetExtendedYear.

Returns the extended year defined by the current fields.
protected int
handleGetLimit(int
one of the above field numbers
field
,
int
one of MINIMUM, GREATEST_MINIMUM, LEAST_MAXIMUM, or MAXIMUM
limitType
)

Implements abstract com.ibm.icu.util.Calendar.handleGetLimit.

Subclass API for defining limits of different types.
protected int
handleGetMonthLength(int extendedYear, int month)

Overrides com.ibm.icu.util.Calendar.handleGetMonthLength.

Returns the length of the given month in the given year
protected int
handleGetYearLength(int eyear)

Overrides com.ibm.icu.util.Calendar.handleGetYearLength.

Returns the number of days in the given Hebrew year
public boolean
protected int
internalGetMonth()

Overrides com.ibm.icu.util.Calendar.internalGetMonth.

Deprecated This API is ICU internal only.
Use this function instead of internalGet(MONTH).
public static boolean
isLeapYear(int year)

Deprecated This API is ICU internal only.
Determine whether a given Hebrew year is a leap year The rule here is that if (year % 19) == 0, 3, 6, 8, 11, 14, or 17.
private static int
monthsInYear(int year)

public void
roll(int
the time field.
field
,
int
the amount by which the field should be rolled.
amount
)

Overrides com.ibm.icu.util.Calendar.roll.

Rolls (up/down) a specified amount time on the given field.
public void
setTemporalMonthCode(String
The value to be set for temporal monthCode.
temporalMonth
)

Overrides com.ibm.icu.util.Calendar.setTemporalMonthCode.

Sets The Temporal monthCode which is a string identifier that starts with the literal grapheme "M" followed by two graphemes representing the zero-padded month number of the current month in a normal (non-leap) year and suffixed by an optional literal grapheme "L" if this is a leap month in a lunisolar calendar.
private static long
startOfYear(int year)

Finds the day # of the first day in the given Hebrew year.

protected void
validateField(int field)

Overrides com.ibm.icu.util.Calendar.validateField.

Deprecated This API is ICU internal only.
Validate a single field of this calendar.
private final int
yearType(int year)

Returns the the type of a given year.

Inherited from com.ibm.icu.util.Calendar:
afterbeforeclearclearclonecompareTocompletecomputeFieldscomputeGregorianFieldscomputeGregorianMonthStartcomputeJulianDaycomputeMillisInDaycomputeMillisInDayLongcomputeTimecomputeZoneOffsetcomputeZoneOffsetequalsfieldDifferencefieldNamefloorDividefloorDividefloorDividefloorDividegetgetActualMaximumgetActualMinimumgetAvailableLocalesgetAvailableULocalesgetDateAtTimePatterngetDateTimeFormatgetDateTimeFormatgetDateTimePatterngetDayOfWeekTypegetDefaultDayInMonthgetDefaultMonthInYeargetDisplayNamegetDisplayNamegetFieldCountgetFieldResolutionTablegetFirstDayOfWeekgetGreatestMinimumgetGregorianDayOfMonthgetGregorianDayOfYeargetGregorianMonthgetGregorianYeargetInstancegetInstancegetInstancegetInstancegetInstancegetInstancegetKeywordValuesForLocalegetLeastMaximumgetLimitgetLocalegetMaximumgetMinimalDaysInFirstWeekgetMinimumgetRelatedYeargetRepeatedWallTimeOptiongetSkippedWallTimeOptiongetStampgetTimegetTimeInMillisgetTimeZonegetWeekDatagetWeekDataForRegiongetWeekendTransitiongregorianMonthLengthgregorianPreviousMonthLengthhandleComputeJulianDayhandleCreateFieldshandleGetDateFormathandleGetDateFormathandleGetDateFormathandleGetDateFormathashCodehaveDefaultCenturyinternalGetinternalGetinternalGetMonthinternalGetTimeInMillisinternalSetisEquivalentToisGregorianLeapYearisLenientisSetisWeekendisWeekendjulianDayToDayOfWeekjulianDayToMillismillisToJulianDaynewerFieldnewestStamppinFieldprepareGetActualresolveFieldsrollsetsetsetsetsetFirstDayOfWeeksetLenientsetLocalesetMinimalDaysInFirstWeeksetRelatedYearsetRepeatedWallTimeOptionsetSkippedWallTimeOptionsetTimesetTimeInMillissetTimeZonesetWeekDatatoStringvalidateFieldvalidateFieldsweekNumberweekNumber

Field Detail

ADARback to summary
public static final int ADAR

Constant for the Adar, the 7th month of the Hebrew year.

ICU Status
Stable since ICU 2.8.
ADAR_1back to summary
public static final int ADAR_1

Constant for Adar I, the 6th month of the Hebrew year (present in leap years only). In non-leap years, the calendar jumps from Shevat (5th month) to Adar (7th month).

ICU Status
Stable since ICU 2.8.
AVback to summary
public static final int AV

Constant for Av, the 12th month of the Hebrew year.

ICU Status
Stable since ICU 2.8.
BAHARADback to summary
private static final long BAHARAD
cacheback to summary
private static CalendarCache cache
DAY_PARTSback to summary
private static final long DAY_PARTS
ELULback to summary
public static final int ELUL

Constant for Elul, the 13th month of the Hebrew year.

ICU Status
Stable since ICU 2.8.
gTemporalMonthCodesForHebrewback to summary
private static String[] gTemporalMonthCodesForHebrew
HESHVANback to summary
public static final int HESHVAN

Constant for Heshvan, the 2nd month of the Hebrew year.

ICU Status
Stable since ICU 2.8.
HOUR_PARTSback to summary
private static final long HOUR_PARTS
IYARback to summary
public static final int IYAR

Constant for Iyar, the 9th month of the Hebrew year.

ICU Status
Stable since ICU 2.8.
KISLEVback to summary
public static final int KISLEV

Constant for Kislev, the 3rd month of the Hebrew year.

ICU Status
Stable since ICU 2.8.
LEAP_MONTH_STARTback to summary
private static final int[][] LEAP_MONTH_START

The cumulative # of days to the end of each month in a leap year

LIMITSback to summary
private static final int[][] LIMITS

Hides com.ibm.icu.util.Calendar.LIMITS.

The absolute date, in milliseconds since 1/1/1970 AD, Gregorian, of the start of the Hebrew calendar. In order to keep this calendar's time of day in sync with that of the Gregorian calendar, we use midnight, rather than sunset the day before.

MONTH_DAYSback to summary
private static final int MONTH_DAYS
MONTH_FRACTback to summary
private static final long MONTH_FRACT
MONTH_LENGTHback to summary
private static final int[][] MONTH_LENGTH

The lengths of the Hebrew months. This is complicated, because there are three different types of years, or six if you count leap years. Due to the rules for postponing the start of the year to avoid having certain holidays fall on the sabbath, the year can end up being three different lengths, called "deficient", "normal", and "complete".

MONTH_PARTSback to summary
private static final long MONTH_PARTS
MONTH_STARTback to summary
private static final int[][] MONTH_START

The cumulative # of days to the end of each month in a non-leap year Although this can be calculated from the MONTH_LENGTH table, keeping it around separately makes some calculations a lot faster

NISANback to summary
public static final int NISAN

Constant for Nisan, the 8th month of the Hebrew year.

ICU Status
Stable since ICU 2.8.
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.ibm.icu.util.Calendar.serialVersionUID.

SHEVATback to summary
public static final int SHEVAT

Constant for Shevat, the 5th month of the Hebrew year.

ICU Status
Stable since ICU 2.8.
SIVANback to summary
public static final int SIVAN

Constant for Sivan, the 10th month of the Hebrew year.

ICU Status
Stable since ICU 2.8.
TAMUZback to summary
public static final int TAMUZ

Constant for Tammuz, the 11th month of the Hebrew year.

ICU Status
Stable since ICU 2.8.
TEVETback to summary
public static final int TEVET

Constant for Tevet, the 4th month of the Hebrew year.

ICU Status
Stable since ICU 2.8.
TISHRIback to summary
public static final int TISHRI

Constant for Tishri, the 1st month of the Hebrew year.

ICU Status
Stable since ICU 2.8.

Constructor Detail

HebrewCalendarback to summary
public HebrewCalendar()

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

ICU Status
Stable since ICU 2.8.
See Also
Category#FORMAT
HebrewCalendarback to summary
public HebrewCalendar(TimeZone zone)

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

Parameters
zone:TimeZone

The time zone for the new calendar.

ICU Status
Stable since ICU 2.8.
See Also
Category#FORMAT
HebrewCalendarback to summary
public HebrewCalendar(Locale aLocale)

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

Parameters
aLocale:Locale

The locale for the new calendar.

ICU Status
Stable since ICU 2.8.
HebrewCalendarback to summary
public HebrewCalendar(ULocale locale)

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

Parameters
locale:ULocale

The locale for the new calendar.

ICU Status
Stable since ICU 3.2.
HebrewCalendarback to summary
public HebrewCalendar(TimeZone zone, Locale aLocale)

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

Parameters
zone:TimeZone

The time zone for the new calendar.

aLocale:Locale

The locale for the new calendar.

ICU Status
Stable since ICU 2.8.
HebrewCalendarback to summary
public HebrewCalendar(TimeZone zone, ULocale locale)

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

Parameters
zone:TimeZone

The time zone for the new calendar.

locale:ULocale

The locale for the new calendar.

ICU Status
Stable since ICU 3.2.
HebrewCalendarback to summary
public HebrewCalendar(int year, int month, int date)

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

Parameters
year:int

The value used to set the calendar's YEAR time field.

month:int

The value used to set the calendar's MONTH time field. The value is 0-based. e.g., 0 for Tishri.

date:int

The value used to set the calendar's DATE time field.

ICU Status
Stable since ICU 2.8.
See Also
Category#FORMAT
HebrewCalendarback to summary
public HebrewCalendar(Date date)

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

Parameters
date:Date

The date to which the new calendar is set.

ICU Status
Stable since ICU 2.8.
See Also
Category#FORMAT
HebrewCalendarback to summary
public HebrewCalendar(int year, int month, int date, int hour, int minute, int second)

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

Parameters
year:int

The value used to set the calendar's YEAR time field.

month:int

The value used to set the calendar's MONTH time field. The value is 0-based. e.g., 0 for Tishri.

date:int

The value used to set the calendar's DATE time field.

hour:int

The value used to set the calendar's HOUR_OF_DAY time field.

minute:int

The value used to set the calendar's MINUTE time field.

second:int

The value used to set the calendar's SECOND time field.

ICU Status
Stable since ICU 2.8.
See Also
Category#FORMAT

Method Detail

addback to summary
public void add(int field, int amount)

Overrides com.ibm.icu.util.Calendar.add.

Add a signed amount to a specified field, using this calendar's rules. For example, to add three days to the current date, you can call add(Calendar.DATE, 3).

When adding to certain fields, the values of other fields may conflict and need to be changed. For example, when adding one to the MONTH field for the date "30 Av 5758", the DAY_OF_MONTH field must be adjusted so that the result is "29 Elul 5758" rather than the invalid "30 Elul 5758".

This method is able to add to all fields except for ERA, DST_OFFSET, and ZONE_OFFSET.

Note

You should always use roll and add rather than attempting to perform arithmetic operations directly on the fields of a HebrewCalendar. Since the MONTH field behaves discontinuously in non-leap years, simple arithmetic can give invalid results.

Parameters
field:int

the time field.

amount:int

the amount to add to the field.

Annotations
@Override
Exceptions
IllegalArgumentException:
if the field is invalid or refers to a field that cannot be handled by this method.
ICU Status
Stable since ICU 2.8.
getTemporalMonthCodeback to summary
public String getTemporalMonthCode()

Overrides com.ibm.icu.util.Calendar.getTemporalMonthCode.

Gets The Temporal monthCode value corresponding to the month for the date. The value is a string identifier that starts with the literal grapheme "M" followed by two graphemes representing the zero-padded month number of the current month in a normal (non-leap) year and suffixed by an optional literal grapheme "L" if this is a leap month in a lunisolar calendar. For the Hebrew calendar, the values are "M01" .. "M12" for non-leap year, and "M01" .. "M05", "M05L", "M06" .. "M12" for leap year.

Returns:String

One of 13 possible strings in {"M01".. "M05", "M05L", "M06" .. "M12"}.

ICU Status
Draft since ICU 74.
getTypeback to summary
public String getType()

Overrides com.ibm.icu.util.Calendar.getType.

Doc from com.ibm.icu.util.Calendar.getType.

ICU

Returns the calendar type name string for this Calendar object. The returned string is the legacy ICU calendar attribute value, for example, "gregorian" or "japanese".

See type="old type name" for the calendar attribute of locale IDs at http://www.unicode.org/reports/tr35/#Key_Type_Definitions

Returns:String

legacy calendar type name string

Annotations
@Override
ICU Status
Stable since ICU 3.8.
handleComputeFieldsback to summary
protected void handleComputeFields(int julianDay)

Overrides com.ibm.icu.util.Calendar.handleComputeFields.

Subclasses may override this method to compute several fields specific to each calendar system. These are:

  • ERA
  • YEAR
  • MONTH
  • DAY_OF_MONTH
  • DAY_OF_YEAR
  • EXTENDED_YEAR
Subclasses can refer to the DAY_OF_WEEK and DOW_LOCAL fields, which will be set when this method is called. Subclasses can also call the getGregorianXxx() methods to obtain Gregorian calendar equivalents for the given Julian day.

In addition, subclasses should compute any subclass-specific fields, that is, fields from BASE_FIELD_COUNT to getFieldCount() - 1.

Annotations
@Override
ICU Status
Stable since ICU 2.8.
handleComputeMonthStartback to summary
protected int handleComputeMonthStart(int eyear, int month, boolean useMonth)

Implements abstract com.ibm.icu.util.Calendar.handleComputeMonthStart.

Return JD of start of given month/year.

Parameters
eyear:int

Doc from com.ibm.icu.util.Calendar.handleComputeMonthStart.

the extended year

month:int

Doc from com.ibm.icu.util.Calendar.handleComputeMonthStart.

the zero-based month, or 0 if useMonth is false

useMonth:boolean

Doc from com.ibm.icu.util.Calendar.handleComputeMonthStart.

if false, compute the day before the first day of the given year, otherwise, compute the day before the first day of the given month

Returns:int

Doc from com.ibm.icu.util.Calendar.handleComputeMonthStart.

the Julian day number of the day before the first day of the given month and year

Annotations
@Override
ICU Status
Stable since ICU 2.8.
handleGetExtendedYearback to summary
protected int handleGetExtendedYear()

Implements abstract com.ibm.icu.util.Calendar.handleGetExtendedYear.

Doc from com.ibm.icu.util.Calendar.handleGetExtendedYear.

Returns the extended year defined by the current fields. This will use the EXTENDED_YEAR field or the YEAR and supra-year fields (such as ERA) specific to the calendar system, depending on which set of fields is newer.

Returns:int

the extended year

Annotations
@Override
ICU Status
Stable since ICU 2.8.
handleGetLimitback to summary
protected int handleGetLimit(int field, int limitType)

Implements abstract com.ibm.icu.util.Calendar.handleGetLimit.

Doc from com.ibm.icu.util.Calendar.handleGetLimit.

Subclass API for defining limits of different types. Subclasses must implement this method to return limits for the following fields:

ERA
YEAR
MONTH
WEEK_OF_YEAR
WEEK_OF_MONTH
DAY_OF_MONTH
DAY_OF_YEAR
DAY_OF_WEEK_IN_MONTH
YEAR_WOY
EXTENDED_YEAR
Parameters
field:int

one of the above field numbers

limitType:int

one of MINIMUM, GREATEST_MINIMUM, LEAST_MAXIMUM, or MAXIMUM

Annotations
@Override
ICU Status
Stable since ICU 2.8.
handleGetMonthLengthback to summary
protected int handleGetMonthLength(int extendedYear, int month)

Overrides com.ibm.icu.util.Calendar.handleGetMonthLength.

Returns the length of the given month in the given year

Annotations
@Override
ICU Status
Stable since ICU 2.8.
handleGetYearLengthback to summary
protected int handleGetYearLength(int eyear)

Overrides com.ibm.icu.util.Calendar.handleGetYearLength.

Returns the number of days in the given Hebrew year

Annotations
@Override
ICU Status
Stable since ICU 2.8.
inTemporalLeapYearback to summary
public boolean inTemporalLeapYear()

Overrides com.ibm.icu.util.Calendar.inTemporalLeapYear.

Doc from com.ibm.icu.util.Calendar.inTemporalLeapYear.

ICU

Returns true if the date is in a leap year. Recalculate the current time field values if the time value has been changed by a call to * setTime(). This method is semantically const, but may alter the object in memory. A "leap year" is a year that contains more days than other years (for solar or lunar calendars) or more months than other years (for lunisolar calendars like Hebrew or Chinese), as defined in the ECMAScript Temporal proposal.
Returns:boolean

true if the date in the fields is in a Temporal proposal defined leap year. False otherwise.

ICU Status
Draft since ICU 74.
internalGetMonthback to summary
protected int internalGetMonth()

Overrides com.ibm.icu.util.Calendar.internalGetMonth.

Doc from com.ibm.icu.util.Calendar.internalGetMonth.

Deprecated

This API is ICU internal only.

Use this function instead of internalGet(MONTH). The implementation check the timestamp of MONTH and ORDINAL_MONTH and use the one set later. The subclass should override it to conver the value of ORDINAL_MONTH to MONTH correctly if ORDINAL_MONTH has higher priority.

Returns:int

the value for the given time field.

Annotations
@Deprecated
ICU Status
Internal ICU component.
isLeapYearback to summary
public static boolean isLeapYear(int year)

Deprecated

This API is ICU internal only.

Determine whether a given Hebrew year is a leap year The rule here is that if (year % 19) == 0, 3, 6, 8, 11, 14, or 17. The formula below performs the same test, believe it or not.

Annotations
@Deprecated
ICU Status
Internal ICU component.
monthsInYearback to summary
private static int monthsInYear(int year)
rollback to summary
public void roll(int field, int amount)

Overrides com.ibm.icu.util.Calendar.roll.

Rolls (up/down) a specified amount time on the given field. For example, to roll the current date up by three days, you can call roll(Calendar.DATE, 3). If the field is rolled past its maximum allowable value, it will "wrap" back to its minimum and continue rolling. For example, calling roll(Calendar.DATE, 10) on a Hebrew calendar set to "25 Av 5758" will result in the date "5 Av 5758".

When rolling certain fields, the values of other fields may conflict and need to be changed. For example, when rolling the MONTH field upward by one for the date "30 Av 5758", the DAY_OF_MONTH field must be adjusted so that the result is "29 Elul 5758" rather than the invalid "30 Elul".

This method is able to roll all fields except for ERA, DST_OFFSET, and ZONE_OFFSET. Subclasses may, of course, add support for additional fields in their overrides of roll.

Note

You should always use roll and add rather than attempting to perform arithmetic operations directly on the fields of a HebrewCalendar. Since the MONTH field behaves discontinuously in non-leap years, simple arithmetic can give invalid results.

Parameters
field:int

the time field.

amount:int

the amount by which the field should be rolled.

Annotations
@Override
Exceptions
IllegalArgumentException:
if the field is invalid or refers to a field that cannot be handled by this method.
ICU Status
Stable since ICU 2.8.
setTemporalMonthCodeback to summary
public void setTemporalMonthCode(String temporalMonth)

Overrides com.ibm.icu.util.Calendar.setTemporalMonthCode.

Sets The Temporal monthCode which is a string identifier that starts with the literal grapheme "M" followed by two graphemes representing the zero-padded month number of the current month in a normal (non-leap) year and suffixed by an optional literal grapheme "L" if this is a leap month in a lunisolar calendar. For Hebrew calendar, the values are "M01" .. "M12" for non-leap years, and "M01" .. "M05", "M05L", "M06" .. "M12" for leap year.

Parameters
temporalMonth:String

The value to be set for temporal monthCode.

ICU Status
Draft since ICU 74.
startOfYearback to summary
private static long startOfYear(int year)

Finds the day # of the first day in the given Hebrew year. To do this, we want to calculate the time of the Tishri 1 new moon in that year.

The algorithm here is similar to ones described in a number of references, including:

validateFieldback to summary
protected void validateField(int field)

Overrides com.ibm.icu.util.Calendar.validateField.

Doc from com.ibm.icu.util.Calendar.validateField.

Deprecated

This API is ICU internal only.

Validate a single field of this calendar. Subclasses should override this method to validate any calendar-specific fields. Generic fields can be handled by Calendar.validateField().

Overrides Calendar#validateField(int) to provide special handling for month validation for Hebrew calendar.

Annotations
@Override
@Deprecated
ICU Status
Internal ICU component.
yearTypeback to summary
private final int yearType(int year)

Returns the the type of a given year. 0 "Deficient" year with 353 or 383 days 1 "Normal" year with 354 or 384 days 2 "Complete" year with 355 or 385 days