@CalendarType(value="hebrew") public final class HebrewCalendar extends Calendrical<HebrewCalendar.Unit,HebrewCalendar> implements LocalizedPatternSupport
Represents the calendar used by the worldwide Jewish community, but mainly in Israel for religious purposes.
It is a lunisolar calendar which defines years consisting of 12 or 13 months. The month cycle generally follows the lunar cycle of synodic moon. However, every two or three years, an extra leap month called ADAR-I will be inserted to synchronize the calendar with the solar year. This is done by help of the metonic cycle. This synchronization is not perfect because the mean length of the hebrew year of 365.2468 days is slightly longer than the tropical solar year. See also Wikipedia. The implementation of this calendar is based on the book "Calendrical calculations" of Dershowitz/Reingold. The hebrew day starts at sunset on the previous day. By default and as rough approximation, the time 18:00 o'clock is used - especially in case of missing geographic location. However, Time4J enables users to use the exact astronomical sunset as begin of day for religious purposes.
Furthermore, all elements defined in EpochDays and CommonElements are supported.
The month Adar-II is printed in different ways dependent on if the associated year is a leap year or not.
HebrewCalendar date = HebrewCalendar.of(5778, HebrewMonth.ADAR_II, 29);
ChronoFormatter<HebrewCalendar> f =
ChronoFormatter.ofPattern(
"MMMM, dd (yyyy)",
PatternType.CLDR_DATE,
Locale.US,
HebrewCalendar.axis());
assertThat(f.format(date), is("Adar, 29 (5778)")); // no leap year
assertThat(f.format(date.plus(1, HebrewCalendar.Unit.YEARS)), is("Adar II, 29 (5779)"));
Locale locale = Locale.forLanguageTag("en-u-ca-hebrew");
ChronoFormatter<CalendarDate> f = ChronoFormatter.ofGenericCalendarStyle(DisplayMode.FULL, locale);
assertThat(
f.format(PlainDate.of(2017, 10, 1)),
is("Sunday, Tishri 11, 5778 AM"));
HebrewAnniversary,
HebrewMonth,
HebrewTime,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
HebrewCalendar.Unit
Defines some calendar units for the Hebrew calendar.
|
| Modifier and Type | Field and Description |
|---|---|
static StdCalendarElement<Integer,HebrewCalendar> |
BOUNDED_WEEK_OF_MONTH
Equivalent to
CommonElements.boundedWeekOfMonth(HebrewCalendar.axis(), HebrewCalendar.getDefaultWeekmodel()). |
static StdCalendarElement<Integer,HebrewCalendar> |
BOUNDED_WEEK_OF_YEAR
Equivalent to
CommonElements.boundedWeekOfYear(HebrewCalendar.axis(), HebrewCalendar.getDefaultWeekmodel()). |
static StdCalendarElement<Integer,HebrewCalendar> |
DAY_OF_MONTH
Represents the Hebrew day of month.
|
static StdCalendarElement<Weekday,HebrewCalendar> |
DAY_OF_WEEK
Represents the Hebrew day of week.
|
static StdCalendarElement<Integer,HebrewCalendar> |
DAY_OF_YEAR
Represents the Hebrew day of year.
|
static ChronoElement<HebrewEra> |
ERA
Represents the Hebrew era.
|
static StdCalendarElement<Weekday,HebrewCalendar> |
LOCAL_DAY_OF_WEEK
Equivalent to
CommonElements.localDayOfWeek(HebrewCalendar.axis(), HebrewCalendar.getDefaultWeekmodel()). |
static StdCalendarElement<HebrewMonth,HebrewCalendar> |
MONTH_OF_YEAR
Represents the Hebrew month.
|
static StdCalendarElement<Integer,HebrewCalendar> |
WEEK_OF_MONTH
Equivalent to
CommonElements.weekOfMonth(HebrewCalendar.axis(), HebrewCalendar.getDefaultWeekmodel()). |
static StdCalendarElement<Integer,HebrewCalendar> |
WEEK_OF_YEAR
Equivalent to
CommonElements.weekOfYear(HebrewCalendar.axis(), HebrewCalendar.getDefaultWeekmodel()). |
static OrdinalWeekdayElement<HebrewCalendar> |
WEEKDAY_IN_MONTH
Element with the ordinal day-of-week within given calendar month.
|
static StdCalendarElement<Integer,HebrewCalendar> |
YEAR_OF_ERA
Represents the Hebrew year.
|
| Modifier and Type | Method and Description |
|---|---|
GeneralTimestamp<HebrewCalendar> |
at(PlainTime time)
Creates a new local timestamp with this date and given civil time.
|
GeneralTimestamp<HebrewCalendar> |
atTime(int hour,
int minute)
Is equivalent to
at(PlainTime.of(hour, minute)). |
static TimeAxis<HebrewCalendar.Unit,HebrewCalendar> |
axis()
Returns the associated time axis.
|
HebrewCalendar |
barMitzvah()
Interpretes this date as birth date of a boy and determines the 13th birthday.
|
HebrewCalendar |
batMitzvah()
Interpretes this date as birth date of a girl and determines the 12th birthday.
|
boolean |
equals(Object obj)
Based on the epoch day number and the calendar system.
|
int |
getDayOfMonth()
Yields the Hebrew day of month.
|
Weekday |
getDayOfWeek()
Determines the day of week.
|
int |
getDayOfYear()
Yields the Hebrew day of year.
|
static Weekmodel |
getDefaultWeekmodel()
Obtains the standard week model of this calendar.
|
HebrewEra |
getEra()
Yields the Hebrew era.
|
HebrewMonth |
getMonth()
Yields the Hebrew month.
|
int |
getYear()
Yields the Hebrew year.
|
int |
hashCode()
Based on the epoch day number.
|
boolean |
isLeapYear()
Is the year of this date a leap year which has 13 instead of 12 months?
|
static boolean |
isLeapYear(int year)
Is the given hebrew year a leap year which has 13 instead of 12 months?
|
boolean |
isRoshChodesh()
Is the year of this date Rosh Chodesh?
|
boolean |
isSabbaticalYear()
Is the year of this date a sabbatical year as described in the bible?
|
static boolean |
isValid(int yearOfEra,
HebrewMonth month,
int dayOfMonth)
Queries if given parameter values form a well defined calendar date.
|
int |
lengthOfMonth()
Yields the length of current Hebrew month in days.
|
int |
lengthOfYear()
Yields the length of current Hebrew year in days.
|
static HebrewCalendar |
nowInSystemTime()
Obtains the current calendar date in system time.
|
static HebrewCalendar |
nowInSystemTime(StartOfDay startOfDay)
Obtains the current calendar date in system time with given start of day.
|
static HebrewCalendar |
of(int year,
HebrewMonth month,
int dom)
Creates a new instance of a Hebrew calendar date.
|
static HebrewCalendar |
ofBiblical(int year,
int month,
int dom)
Creates a new instance of a Hebrew calendar date.
|
static HebrewCalendar |
ofCivil(int year,
int month,
int dom)
Creates a new instance of a Hebrew calendar date.
|
String |
toString()
Provides a complete textual representation of the state of
this time point.
|
compareTo, getDaysSinceEpochUTC, isAfter, isBefore, isSimultaneous, minus, plusmax, min, minus, minus, plus, plus, until, untilcontains, get, get, getInt, getMaximum, getMinimum, getRegisteredElements, getTimezone, hasTimezone, isValid, isValid, isValid, matches, with, with, with, withgetFormatPattern, getFormatPattern, useDynamicFormatPatternfrom, from, from, transform, transform, transform, transform, transform, transformisAfterAll, isAfterOrEqual, isBeforeAll, isBeforeOrEqual@FormattableElement(format="G") public static final ChronoElement<HebrewEra> ERA
Represents the Hebrew era.
@FormattableElement(format="y") public static final StdCalendarElement<Integer,HebrewCalendar> YEAR_OF_ERA
Represents the Hebrew year.
@FormattableElement(format="M", alt="L") public static final StdCalendarElement<HebrewMonth,HebrewCalendar> MONTH_OF_YEAR
Represents the Hebrew month.
@FormattableElement(format="d") public static final StdCalendarElement<Integer,HebrewCalendar> DAY_OF_MONTH
Represents the Hebrew day of month.
@FormattableElement(format="D") public static final StdCalendarElement<Integer,HebrewCalendar> DAY_OF_YEAR
Represents the Hebrew day of year.
@FormattableElement(format="E") public static final StdCalendarElement<Weekday,HebrewCalendar> DAY_OF_WEEK
Represents the Hebrew day of week.
If the day-of-week is set to a new value then Time4J handles the Hebrew calendar week as starting on Sunday (more precisely on Saturday evening).
@FormattableElement(format="F") public static final OrdinalWeekdayElement<HebrewCalendar> WEEKDAY_IN_MONTH
Element with the ordinal day-of-week within given calendar month.
public static final StdCalendarElement<Weekday,HebrewCalendar> LOCAL_DAY_OF_WEEK
Equivalent to
CommonElements.localDayOfWeek(HebrewCalendar.axis(), HebrewCalendar.getDefaultWeekmodel()).
CommonElements.localDayOfWeek(Chronology, Weekmodel),
getDefaultWeekmodel()public static final StdCalendarElement<Integer,HebrewCalendar> WEEK_OF_YEAR
Equivalent to
CommonElements.weekOfYear(HebrewCalendar.axis(), HebrewCalendar.getDefaultWeekmodel()).
CommonElements.weekOfYear(Chronology, Weekmodel),
getDefaultWeekmodel()public static final StdCalendarElement<Integer,HebrewCalendar> WEEK_OF_MONTH
Equivalent to
CommonElements.weekOfMonth(HebrewCalendar.axis(), HebrewCalendar.getDefaultWeekmodel()).
CommonElements.weekOfMonth(Chronology, Weekmodel),
getDefaultWeekmodel()public static final StdCalendarElement<Integer,HebrewCalendar> BOUNDED_WEEK_OF_YEAR
Equivalent to
CommonElements.boundedWeekOfYear(HebrewCalendar.axis(), HebrewCalendar.getDefaultWeekmodel()).
CommonElements.boundedWeekOfYear(Chronology, Weekmodel),
getDefaultWeekmodel()public static final StdCalendarElement<Integer,HebrewCalendar> BOUNDED_WEEK_OF_MONTH
Equivalent to
CommonElements.boundedWeekOfMonth(HebrewCalendar.axis(), HebrewCalendar.getDefaultWeekmodel()).
CommonElements.boundedWeekOfMonth(Chronology, Weekmodel),
getDefaultWeekmodel()public static HebrewCalendar of(int year, HebrewMonth month, int dom)
Creates a new instance of a Hebrew calendar date.
year - Hebrew year in the range 1-9999month - Hebrew monthdom - Hebrew day of month in range 1-30HebrewCalendarIllegalArgumentException - in case of any inconsistenciespublic static HebrewCalendar ofCivil(int year, int month, int dom)
Creates a new instance of a Hebrew calendar date.
year - Hebrew year in the range 1-9999month - Hebrew civil month in the range 1-13dom - Hebrew day of month in range 1-30HebrewCalendarIllegalArgumentException - in case of any inconsistenciesHebrewMonth.getCivilValue(boolean)public static HebrewCalendar ofBiblical(int year, int month, int dom)
Creates a new instance of a Hebrew calendar date.
year - Hebrew year in the range 1-9999month - Hebrew biblical month in the range 1-13dom - Hebrew day of month in range 1-30HebrewCalendarIllegalArgumentException - in case of any inconsistenciesHebrewMonth.getBiblicalValue(boolean)public static HebrewCalendar nowInSystemTime()
Obtains the current calendar date in system time.
Convenient short-cut for: SystemClock.inLocalView().now(HebrewCalendar.axis()).
Attention: The Hebrew calendar changes here the date in the evening at 6 PM (on previous day).
If users wish more control over the start of day then following code might be used:
SolarTime jerusalem = SolarTime.ofLocation(31.779167, 35.223611);
HebrewCalendar currentHebrewDate =
HebrewCalendar.nowInSystemTime(StartOfDay.definedBy(jerusalem.sunset()));
SystemClock.inLocalView(),
ZonalClock.now(Chronology),
StartOfDay.definedBy(ChronoFunction),
SolarTime.sunset()public static HebrewCalendar nowInSystemTime(StartOfDay startOfDay)
Obtains the current calendar date in system time with given start of day.
startOfDay - exact definition when the day starts (should be sunset on previous day)StartOfDay.definedBy(ChronoFunction),
SolarTime.sunset()public HebrewEra getEra()
Yields the Hebrew era.
HebrewEra.ANNO_MUNDIpublic int getYear()
Yields the Hebrew year.
public HebrewMonth getMonth()
Yields the Hebrew month.
public int getDayOfMonth()
Yields the Hebrew day of month.
public Weekday getDayOfWeek()
Determines the day of week.
The Hebrew calendar also uses a 7-day-week.
public int getDayOfYear()
Yields the Hebrew day of year.
public int lengthOfMonth()
Yields the length of current Hebrew month in days.
public int lengthOfYear()
Yields the length of current Hebrew year in days.
public static boolean isLeapYear(int year)
Is the given hebrew year a leap year which has 13 instead of 12 months?
The years 3, 6, 8, 11, 14, 17 and 19 in the 19 year Metonic cycle are leap years.
year - the hebrew yearIllegalArgumentException - if the year is not positivepublic boolean isLeapYear()
Is the year of this date a leap year which has 13 instead of 12 months?
isLeapYear(int)public boolean isSabbaticalYear()
Is the year of this date a sabbatical year as described in the bible?
Every seventh year is a sabbatical year, see Exodus 23:10-11.
public boolean isRoshChodesh()
Is the year of this date Rosh Chodesh?
This term describes the head of the month where the day-of-month is 1 unless it is the month Tishri. If the previous month has 30 days then the 30th of the previous month is also associated with the Rosh Chodesh. Note that Tishri 1 is Rosh Hashana (head of the year).
public static boolean isValid(int yearOfEra,
HebrewMonth month,
int dayOfMonth)
Queries if given parameter values form a well defined calendar date.
yearOfEra - the year of era to be checkedmonth - the month to be checkeddayOfMonth - the day of month to be checkedtrue if valid else falseof(int, HebrewMonth, int)public HebrewCalendar barMitzvah()
Interpretes this date as birth date of a boy and determines the 13th birthday.
HebrewAnniversary.BIRTHDAYpublic HebrewCalendar batMitzvah()
Interpretes this date as birth date of a girl and determines the 12th birthday.
HebrewAnniversary.BIRTHDAYpublic GeneralTimestamp<HebrewCalendar> at(PlainTime time)
Creates a new local timestamp with this date and given civil time.
If the time T24:00 is used
then the resulting timestamp will automatically be normalized such
that the timestamp will contain the following day instead.
An alternative to the civil time is the usage of the HebrewTime
according to the descriptions in the bible and torah.
time - wall timeHebrewTime.on(HebrewCalendar, SolarTime),
HebrewTime.on(HebrewCalendar, Timezone)public GeneralTimestamp<HebrewCalendar> atTime(int hour, int minute)
Is equivalent to at(PlainTime.of(hour, minute)).
hour - hour of day in range (0-24)minute - minute of hour in range (0-59)IllegalArgumentException - if any argument is out of rangeat(PlainTime),
HebrewTime.on(HebrewCalendar, SolarTime),
HebrewTime.on(HebrewCalendar, Timezone)public boolean equals(Object obj)
CalendricalBased on the epoch day number and the calendar system.
In other words: Two date object are equal if they have the same temporal position on the local timeline and have the same calendrical type. Subclasses which define further state attributes must override this method.
If an only temporal comparison is required then the method
Calendrical.isSimultaneous(CalendarDate) is to be used.
equals in class Calendrical<HebrewCalendar.Unit,HebrewCalendar>Chronology.getChronoType()public int hashCode()
CalendricalBased on the epoch day number.
hashCode in class Calendrical<HebrewCalendar.Unit,HebrewCalendar>public String toString()
TimePointProvides a complete textual representation of the state of this time point.
The textual description often follows the conventions of ISO-8601. Usually the description starts with the chronological informations which are coarse-grained and ends with those ones which are fine-grained (for example the ISO-notation YYYY-MM-DD).
toString in class TimePoint<HebrewCalendar.Unit,HebrewCalendar>public static Weekmodel getDefaultWeekmodel()
Obtains the standard week model of this calendar.
The Hebrew calendar usually starts on Sunday (more precisely on Saturday evening). Friday and Saturday are considered as weekend (as usual in Israel).
public static TimeAxis<HebrewCalendar.Unit,HebrewCalendar> axis()
Returns the associated time axis.
Copyright © 2014–2021. All rights reserved.