|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ibm.icu.util.Calendar
com.ibm.icu.util.HebrewCalendar
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:
Note This API has not been promoted to @stable and instead has been left as @draft ICU 2.8. It may yet change or be removed in a future release.
GregorianCalendar,
Serialized Form| Field Summary | |
static int |
ADAR
Deprecated. This is a draft API and might change in a future release of ICU. |
static int |
ADAR_1
Deprecated. This is a draft API and might change in a future release of ICU. |
static int |
AV
Deprecated. This is a draft API and might change in a future release of ICU. |
static int |
ELUL
Deprecated. This is a draft API and might change in a future release of ICU. |
static int |
HESHVAN
Deprecated. This is a draft API and might change in a future release of ICU. |
static int |
IYAR
Deprecated. This is a draft API and might change in a future release of ICU. |
static int |
KISLEV
Deprecated. This is a draft API and might change in a future release of ICU. |
static int |
NISAN
Deprecated. This is a draft API and might change in a future release of ICU. |
static int |
SHEVAT
Deprecated. This is a draft API and might change in a future release of ICU. |
static int |
SIVAN
Deprecated. This is a draft API and might change in a future release of ICU. |
static int |
TAMUZ
Deprecated. This is a draft API and might change in a future release of ICU. |
static int |
TEVET
Deprecated. This is a draft API and might change in a future release of ICU. |
static int |
TISHRI
Deprecated. This is a draft API and might change in a future release of ICU. |
| Fields inherited from class com.ibm.icu.util.Calendar |
AM, AM_PM, APRIL, AUGUST, BASE_FIELD_COUNT, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DOW_LOCAL, DST_OFFSET, EPOCH_JULIAN_DAY, ERA, EXTENDED_YEAR, FEBRUARY, FRIDAY, GREATEST_MINIMUM, HOUR, HOUR_OF_DAY, INTERNALLY_SET, JAN_1_1_JULIAN_DAY, JANUARY, JULIAN_DAY, JULY, JUNE, LEAST_MAXIMUM, MARCH, MAX_DATE, MAX_FIELD_COUNT, MAX_JULIAN, MAX_MILLIS, MAXIMUM, MAY, MILLISECOND, MILLISECONDS_IN_DAY, MIN_DATE, MIN_JULIAN, MIN_MILLIS, MINIMUM, MINIMUM_USER_STAMP, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_SECOND, ONE_WEEK, PM, RESOLVE_REMAP, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, TUESDAY, UNDECIMBER, UNSET, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, WEEKDAY, WEEKEND, WEEKEND_CEASE, WEEKEND_ONSET, YEAR, YEAR_WOY, ZONE_OFFSET |
| Constructor Summary | |
HebrewCalendar()
Deprecated. This is a draft API and might change in a future release of ICU. |
|
HebrewCalendar(Date date)
Deprecated. This is a draft API and might change in a future release of ICU. |
|
HebrewCalendar(int year,
int month,
int date)
Deprecated. This is a draft API and might change in a future release of ICU. |
|
HebrewCalendar(int year,
int month,
int date,
int hour,
int minute,
int second)
Deprecated. This is a draft API and might change in a future release of ICU. |
|
HebrewCalendar(Locale aLocale)
Deprecated. This is a draft API and might change in a future release of ICU. |
|
HebrewCalendar(TimeZone zone)
Deprecated. This is a draft API and might change in a future release of ICU. |
|
HebrewCalendar(TimeZone zone,
Locale aLocale)
Deprecated. This is a draft API and might change in a future release of ICU. |
|
HebrewCalendar(TimeZone zone,
ULocale locale)
Deprecated. This is a draft API and might change in a future release of ICU. |
|
HebrewCalendar(ULocale locale)
Deprecated. This is a draft API and might change in a future release of ICU. |
|
| Method Summary | |
void |
add(int field,
int amount)
Deprecated. This is a draft API and might change in a future release of ICU. |
String |
getType()
Deprecated. Return the current Calendar type. |
protected void |
handleComputeFields(int julianDay)
Deprecated. This is a draft API and might change in a future release of ICU. |
protected int |
handleComputeMonthStart(int eyear,
int month,
boolean useMonth)
Deprecated. This is a draft API and might change in a future release of ICU. |
protected int |
handleGetExtendedYear()
Deprecated. Return the extended year defined by the current fields. |
protected int |
handleGetLimit(int field,
int limitType)
Deprecated. Subclass API for defining limits of different types. |
protected int |
handleGetMonthLength(int extendedYear,
int month)
Deprecated. This is a draft API and might change in a future release of ICU. |
protected int |
handleGetYearLength(int eyear)
Deprecated. This is a draft API and might change in a future release of ICU. |
void |
roll(int field,
int amount)
Deprecated. This is a draft API and might change in a future release of ICU. |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int TISHRI
public static final int HESHVAN
public static final int KISLEV
public static final int TEVET
public static final int SHEVAT
public static final int ADAR_1
public static final int ADAR
public static final int NISAN
public static final int IYAR
public static final int SIVAN
public static final int TAMUZ
public static final int AV
public static final int ELUL
| Constructor Detail |
public HebrewCalendar()
HebrewCalendar using the current time
in the default time zone with the default locale.
public HebrewCalendar(TimeZone zone)
HebrewCalendar based on the current time
in the given time zone with the default locale.
zone - The time zone for the new calendar.public HebrewCalendar(Locale aLocale)
HebrewCalendar based on the current time
in the default time zone with the given locale.
aLocale - The locale for the new calendar.public HebrewCalendar(ULocale locale)
HebrewCalendar based on the current time
in the default time zone with the given locale.
locale - The locale for the new calendar.
public HebrewCalendar(TimeZone zone,
Locale aLocale)
HebrewCalendar based on the current time
in the given time zone with the given locale.
zone - The time zone for the new calendar.aLocale - The locale for the new calendar.
public HebrewCalendar(TimeZone zone,
ULocale locale)
HebrewCalendar based on the current time
in the given time zone with the given locale.
zone - The time zone for the new calendar.locale - The locale for the new calendar.
public HebrewCalendar(int year,
int month,
int date)
HebrewCalendar with the given date set
in the default time zone with the default locale.
year - The value used to set the calendar's YEAR time field.month - The value used to set the calendar's MONTH time field.
The value is 0-based. e.g., 0 for Tishri.date - The value used to set the calendar's DATE time field.public HebrewCalendar(Date date)
HebrewCalendar with the given date set
in the default time zone with the default locale.
date - The date to which the new calendar is set.
public HebrewCalendar(int year,
int month,
int date,
int hour,
int minute,
int second)
HebrewCalendar with the given date
and time set for the default time zone with the default locale.
year - The value used to set the calendar's YEAR time field.month - The value used to set the calendar's MONTH time field.
The value is 0-based. e.g., 0 for Tishri.date - The value used to set the calendar's DATE time field.hour - The value used to set the calendar's HOUR_OF_DAY time field.minute - The value used to set the calendar's MINUTE time field.second - The value used to set the calendar's SECOND time field.| Method Detail |
public void add(int field,
int amount)
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.
add in class Calendarfield - the time field.amount - the amount to add to the field.
IllegalArgumentException - if the field is invalid or refers
to a field that cannot be handled by this method.Calendar.roll(int, int)
public void roll(int field,
int amount)
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.
roll in class Calendarfield - the time field.amount - the amount by which the field should be rolled.
IllegalArgumentException - if the field is invalid or refers
to a field that cannot be handled by this method.Calendar.roll(int, boolean),
Calendar.add(int, int)
protected int handleGetLimit(int field,
int limitType)
CalendarERA YEAR MONTH WEEK_OF_YEAR WEEK_OF_MONTH DAY_OF_MONTH DAY_OF_YEAR DAY_OF_WEEK_IN_MONTH YEAR_WOY EXTENDED_YEAR
handleGetLimit in class Calendarfield - one of the above field numberslimitType - one of MINIMUM, GREATEST_MINIMUM,
LEAST_MAXIMUM, or MAXIMUM
protected int handleGetMonthLength(int extendedYear,
int month)
handleGetMonthLength in class Calendarprotected int handleGetYearLength(int eyear)
handleGetYearLength in class Calendarprotected void handleComputeFields(int julianDay)
In addition, subclasses should compute any subclass-specific fields, that is, fields from BASE_FIELD_COUNT to getFieldCount() - 1.
handleComputeFields in class Calendarprotected int handleGetExtendedYear()
Calendar
handleGetExtendedYear in class Calendar
protected int handleComputeMonthStart(int eyear,
int month,
boolean useMonth)
handleComputeMonthStart in class Calendareyear - the extended yearmonth - the zero-based month, or 0 if useMonth is falseuseMonth - 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
public String getType()
getType in class Calendar
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||