Class HebrewTime

All Implemented Interfaces:
Serializable, Comparable<HebrewTime>, ChronoDisplay, Temporal<HebrewTime>

@CalendarType("hebrew") public final class HebrewTime extends TimePoint<HebrewTime.Unit,​HebrewTime> implements Temporal<HebrewTime>

Represents the 12-hour-time used in Jewish calendar starting in the evening at either sunset or simplified at 6 PM as zero point.

Introduction

The calendar day is divided into day and night, or more precisely into two periods from sunset to sunrise and then to next sunset. Each period is again divided into 12 timely hours which have no fixed length due to seasonal changes. And each such hour is divided into 1080 parts (halakim). See also: www.torahcalendar.com.

Hebrew clock

Following elements which are declared as constants are registered by this class:

Formatting example

A suitable formatter can be constructed by help of dynamic format patterns, but not by the standard format pattern CLDR:

     HebrewTime htime = HebrewTime.ofNight(12, 540);
     ChronoFormatter<HebrewTime> f =
          ChronoFormatter.ofPattern("H'H' P'P'", PatternType.DYNAMIC, Locale.ROOT, HebrewTime.axis());
     assertThat(f.format(htime), is("0H 540P"));
 
Since:
3.37/4.32
Author:
Meno Hochschild
See Also:
HebrewCalendar, PatternType.DYNAMIC, Serialized Form
  • Field Details

  • Method Details

    • ofDigital

      public static HebrewTime ofDigital(int hour23, int part)

      Obtains an instance of Hebrew time between two sunsets.

      Parameters:
      hour23 - hebrew hour in the digital range 0-23
      part - the part of hour (helek) in range 0-1079
      Returns:
      Hebrew time
    • ofNight

      public static HebrewTime ofNight(int hour12, int part)

      Obtains an instance of Hebrew time between sunset and sunrise (night).

      Parameters:
      hour12 - hebrew hour in the biblical range 1-12 during night
      part - the part of hour (helek) in range 0-1079
      Returns:
      Hebrew time
    • ofDay

      public static HebrewTime ofDay(int hour12, int part)

      Obtains an instance of Hebrew time between sunrise and sunset (day).

      Parameters:
      hour12 - hebrew hour in the biblical range 1-12 during day
      part - the part of hour (helek) in range 0-1079
      Returns:
      Hebrew time
    • now

      public static Optional<HebrewTime> now(SolarTime geoLocation)

      Obtains the current Hebrew time in system time and at given geographical position.

      Parameters:
      geoLocation - the geographical position as basis of the solar time
      Returns:
      current Hebrew time at given location (optional)
      See Also:
      SystemClock.currentMoment(), at(SolarTime)
    • nowInSystemTime

      public static HebrewTime nowInSystemTime()

      Obtains the current simplified Hebrew time in system time on a fixed 24-hour-scale.

      Convenient short-cut for: SystemClock.inLocalView().now(HebrewTime.axis()).

      Returns:
      current Hebrew time in system time zone using the system clock on a fixed 24-hour-scale
      See Also:
      SystemClock.inLocalView(), ZonalClock.now(Chronology), now(SolarTime), at(TZID), on(HebrewCalendar, Timezone)
    • at

      public static ChronoFunction<Moment,​Optional<HebrewTime>> at(SolarTime geoLocation)

      Obtains the Hebrew time dependent on given moment and location related to solar time.

      The length of hours varies with the geographical position and the seasonal drift of length of day. Furthermore, the Hebrew time cannot be determined in circumpolar regions when the sun never rises or sets.

      Parameters:
      geoLocation - the geographical position as basis of the solar time
      Returns:
      function which maps a moment to hebrew time
      See Also:
      now(SolarTime), on(HebrewCalendar, SolarTime)
    • at

      public static ChronoFunction<Moment,​HebrewTime> at(TZID tzid)

      Obtains the simplified Hebrew time dependent on given moment and a 24-hour-fixed scale.

      The simplified Hebrew time always starts on 6 pm in the evening. A more exact conversion can be obtained by at(SolarTime).

      Parameters:
      tzid - timezone identifier
      Returns:
      function which maps a moment to hebrew time
      See Also:
      nowInSystemTime(), on(HebrewCalendar, Timezone)
    • isNight

      public boolean isNight()

      Is this time during night when the sun is below the horizon?

      Returns:
      boolean
    • isDay

      public boolean isDay()

      Is this time during day when the sun is above the horizon?

      Returns:
      boolean
    • getClockHour

      public int getClockHour()

      Yields the Hebrew hour in the biblical range 1-12.

      Returns:
      hour in range 1-12
      See Also:
      isNight(), isDay()
    • getDigitalHour

      public int getDigitalHour()

      Yields the Hebrew hour in the digital value range 0-23.

      Returns:
      hour in range 0-23
    • getPart

      public int getPart()

      Yields the part of hour (helek).

      Returns:
      int in range 0-1079
    • isAfter

      public boolean isAfter(HebrewTime other)
      Description copied from interface: Temporal

      Queries if this object is after given object on a timeline.

      Specified by:
      isAfter in interface Temporal<HebrewTime>
      Parameters:
      other - object this instance is compared to
      Returns:
      true if this instance is temporally after temporal else false
    • isBefore

      public boolean isBefore(HebrewTime other)
      Description copied from interface: Temporal

      Queries if this object is before given object on a timeline.

      Specified by:
      isBefore in interface Temporal<HebrewTime>
      Parameters:
      other - object this instance is compared to
      Returns:
      true if this instance is temporally before temporal else false
    • isSimultaneous

      public boolean isSimultaneous(HebrewTime other)
      Description copied from interface: Temporal

      Queries if this object and given object have the same position on the time axis.

      Is equivalent to !isAfter(temporal) && !isBefore(temporal). This method differs from the Object-method equals() such that first the comparison type must be a temporal one and second that only temporal-only state will be considered.

      Specified by:
      isSimultaneous in interface Temporal<HebrewTime>
      Parameters:
      other - object this instance is compared to
      Returns:
      true if this instance is temporally equal to temporal else false
    • compareTo

      public int compareTo(HebrewTime other)
      Description copied from class: TimePoint

      Compares two time points preferably by their temporal positions on the common time axis.

      Implementation note: In order to make the natural order consistent with equals() the whole state must be taken into account, with preference for those attributes which define the temporal position on the time axis.

      Specified by:
      compareTo in interface Comparable<HebrewTime>
      Specified by:
      compareTo in class TimePoint<HebrewTime.Unit,​HebrewTime>
      See Also:
      TimePoint.equals(Object)
    • equals

      public boolean equals(Object obj)
      Description copied from class: TimePoint

      Compares the whole state of this instance with given object.

      Implementations will usually define their state only based on the temporal position on the time axis because this is the most intuitive approach. Exceptions from this rule should be explicitly documented and reasoned.

      Specified by:
      equals in class TimePoint<HebrewTime.Unit,​HebrewTime>
      See Also:
      TimePoint.compareTo(TimePoint)
    • hashCode

      public int hashCode()
      Description copied from class: TimePoint

      Subclasses must redefine this method corresponding to the behaviour of equals().

      Specified by:
      hashCode in class TimePoint<HebrewTime.Unit,​HebrewTime>
    • toString

      public String toString()
      Description copied from class: TimePoint

      Provides 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).

      Specified by:
      toString in class TimePoint<HebrewTime.Unit,​HebrewTime>
    • on

      public Optional<Moment> on(HebrewCalendar date, SolarTime geoLocation)

      Obtains the moment at this Hebrew time on given date at the given geographical position.

      Note: The practical precision of this method is constrained to minutes.

      Parameters:
      date - the Hebrew date to be combined with this time
      geoLocation - the geographical position as basis of the solar time
      Returns:
      Moment (optional)
      See Also:
      now(SolarTime), at(SolarTime)
    • on

      public Moment on(HebrewCalendar date, Timezone tz)

      Obtains the moment at this simplified Hebrew time on given date using a fixed 24-hour-scale.

      The simplified Hebrew time always starts on 6 pm in the evening. A more exact conversion can be obtained by on(HebrewCalendar, SolarTime). Attention: This method might have very small rounding errors in nanosecond range because halakim cannot always be converted to seconds in an exact way.

      Parameters:
      date - the Hebrew date to be combined with this time
      tz - timezone
      Returns:
      Moment
      See Also:
      nowInSystemTime(), at(TZID)
    • axis

      public static TimeAxis<HebrewTime.Unit,​HebrewTime> axis()

      Provides a static access to the associated time axis respective chronology which contains the chronological rules.

      Returns:
      chronological system as time axis (never null)