Class/Object

java.time.zone

ZoneRules

Related Docs: object ZoneRules | package zone

Permalink

abstract class ZoneRules extends AnyRef

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ZoneRules
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def getDaylightSavings(instant: Instant): Duration

    Permalink

    Gets the amount of daylight savings in use for the specified instant in this zone.

    Gets the amount of daylight savings in use for the specified instant in this zone.

    This provides access to historic information on how the amount of daylight savings has changed over time. This is the difference between the standard offset and the actual offset. Typically the amount is zero during winter and one hour during summer. Time-zones are second-based, so the nanosecond part of the duration will be zero.

    instant

    the instant to find the daylight savings for, not null, but null may be ignored if the rules have a single offset for all instants

    returns

    the difference between the standard and actual offset, not null

  2. abstract def getOffset(localDateTime: LocalDateTime): ZoneOffset

    Permalink

    Gets a suitable offset for the specified local date-time in these rules.

    Gets a suitable offset for the specified local date-time in these rules.

    The mapping from a local date-time to an offset is not straightforward. There are three cases:

    • Normal, with one valid offset. For the vast majority of the year, the normal case applies, where there is a single valid offset for the local date-time.
    • Gap, with zero valid offsets. This is when clocks jump forward typically due to the spring daylight savings change from "winter" to "summer". In a gap there are local date-time values with no valid offset.
    • Overlap, with two valid offsets. This is when clocks are set back typically due to the autumn daylight savings change from "summer" to "winter". In an overlap there are local date-time values with two valid offsets.

    Thus, for any given local date-time there can be zero, one or two valid offsets. This method returns the single offset in the Normal case, and in the Gap or Overlap case it returns the offset before the transition.

    Since, in the case of Gap and Overlap, the offset returned is a "best" value, rather than the "correct" value, it should be treated with care. Applications that care about the correct offset should use a combination of this method, #getValidOffsets(LocalDateTime) and #getTransition(LocalDateTime).

    localDateTime

    the local date-time to query, not null, but null may be ignored if the rules have a single offset for all instants

    returns

    the best available offset for the local date-time, not null

  3. abstract def getOffset(instant: Instant): ZoneOffset

    Permalink

    Gets the offset applicable at the specified instant in these rules.

    Gets the offset applicable at the specified instant in these rules.

    The mapping from an instant to an offset is simple, there is only one valid offset for each instant. This method returns that offset.

    instant

    the instant to find the offset for, not null, but null may be ignored if the rules have a single offset for all instants

    returns

    the offset, not null

  4. abstract def getStandardOffset(instant: Instant): ZoneOffset

    Permalink

    Gets the standard offset for the specified instant in this zone.

    Gets the standard offset for the specified instant in this zone.

    This provides access to historic information on how the standard offset has changed over time. The standard offset is the offset before any daylight saving time is applied. This is typically the offset applicable during winter.

    instant

    the instant to find the offset information for, not null, but null may be ignored if the rules have a single offset for all instants

    returns

    the standard offset, not null

  5. abstract def getTransition(localDateTime: LocalDateTime): ZoneOffsetTransition

    Permalink

    Gets the offset transition applicable at the specified local date-time in these rules.

    Gets the offset transition applicable at the specified local date-time in these rules.

    The mapping from a local date-time to an offset is not straightforward. There are three cases:

    • Normal, with one valid offset. For the vast majority of the year, the normal case applies, where there is a single valid offset for the local date-time.
    • Gap, with zero valid offsets. This is when clocks jump forward typically due to the spring daylight savings change from "winter" to "summer". In a gap there are local date-time values with no valid offset.
    • Overlap, with two valid offsets. This is when clocks are set back typically due to the autumn daylight savings change from "summer" to "winter". In an overlap there are local date-time values with two valid offsets.

    A transition is used to model the cases of a Gap or Overlap. The Normal case will return null.

    There are various ways to handle the conversion from a LocalDateTime. One technique, using this method, would be:

    ZoneOffsetTransition trans = rules.getTransition(localDT);
    if (trans == null) {
    // Gap or Overlap: determine what to do from transition
    } else {
    // Normal case: only one valid offset
    zoneOffset = rule.getOffset(localDT);
    }
    

    localDateTime

    the local date-time to query for offset transition, not null, but null may be ignored if the rules have a single offset for all instants

    returns

    the offset transition, null if the local date-time is not in transition

  6. abstract def getTransitionRules: List[ZoneOffsetTransitionRule]

    Permalink

    Gets the list of transition rules for years beyond those defined in the transition list.

    Gets the list of transition rules for years beyond those defined in the transition list.

    The complete set of transitions for this rules instance is defined by this method and #getTransitions(). This method returns instances of ZoneOffsetTransitionRule that define an algorithm for when transitions will occur.

    For any given ZoneRules, this list contains the transition rules for years beyond those years that have been fully defined. These rules typically refer to future daylight saving time rule changes.

    If the zone defines daylight savings into the future, then the list will normally be of size two and hold information about entering and exiting daylight savings. If the zone does not have daylight savings, or information about future changes is uncertain, then the list will be empty.

    The list will be empty for fixed offset rules and for any time-zone where there is no daylight saving time. The list will also be empty if the transition rules are unknown.

    returns

    an immutable list of transition rules, not null

  7. abstract def getTransitions: List[ZoneOffsetTransition]

    Permalink

    Gets the complete list of fully defined transitions.

    Gets the complete list of fully defined transitions.

    The complete set of transitions for this rules instance is defined by this method and #getTransitionRules(). This method returns those transitions that have been fully defined. These are typically historical, but may be in the future.

    The list will be empty for fixed offset rules and for any time-zone where there has only ever been a single offset. The list will also be empty if the transition rules are unknown.

    returns

    an immutable list of fully defined transitions, not null

  8. abstract def getValidOffsets(localDateTime: LocalDateTime): List[ZoneOffset]

    Permalink

    Gets the offset applicable at the specified local date-time in these rules.

    Gets the offset applicable at the specified local date-time in these rules.

    The mapping from a local date-time to an offset is not straightforward. There are three cases:

    • Normal, with one valid offset. For the vast majority of the year, the normal case applies, where there is a single valid offset for the local date-time.
    • Gap, with zero valid offsets. This is when clocks jump forward typically due to the spring daylight savings change from "winter" to "summer". In a gap there are local date-time values with no valid offset.
    • Overlap, with two valid offsets. This is when clocks are set back typically due to the autumn daylight savings change from "summer" to "winter". In an overlap there are local date-time values with two valid offsets.

    Thus, for any given local date-time there can be zero, one or two valid offsets. This method returns that list of valid offsets, which is a list of size 0, 1 or 2. In the case where there are two offsets, the earlier offset is returned at index 0 and the later offset at index 1.

    There are various ways to handle the conversion from a LocalDateTime. One technique, using this method, would be:

    List validOffsets = rules.getOffset(localDT);
    if (validOffsets.size() == 1) {
    // Normal case: only one valid offset
    zoneOffset = validOffsets.get(0);
    } else {
    // Gap or Overlap: determine what to do from transition (which will be non-null)
    ZoneOffsetTransition trans = rules.getTransition(localDT);
    }
    

    In theory, it is possible for there to be more than two valid offsets. This would happen if clocks to be put back more than once in quick succession. This has never happened in the history of time-zones and thus has no special handling. However, if it were to happen, then the list would return more than 2 entries.

    localDateTime

    the local date-time to query for valid offsets, not null, but null may be ignored if the rules have a single offset for all instants

    returns

    the list of valid offsets, may be immutable, not null

  9. abstract def isDaylightSavings(instant: Instant): Boolean

    Permalink

    Checks if the specified instant is in daylight savings.

    Checks if the specified instant is in daylight savings.

    This checks if the standard and actual offsets are the same at the specified instant.

    instant

    the instant to find the offset information for, not null, but null may be ignored if the rules have a single offset for all instants

    returns

    the standard offset, not null

  10. abstract def isFixedOffset: Boolean

    Permalink

    Checks of the zone rules are fixed, such that the offset never varies.

    Checks of the zone rules are fixed, such that the offset never varies.

    returns

    true if the time-zone is fixed and the offset never changes

  11. abstract def isValidOffset(localDateTime: LocalDateTime, offset: ZoneOffset): Boolean

    Permalink

    Checks if the offset date-time is valid for these rules.

    Checks if the offset date-time is valid for these rules.

    To be valid, the local date-time must not be in a gap and the offset must match the valid offsets.

    localDateTime

    the date-time to check, not null, but null may be ignored if the rules have a single offset for all instants

    offset

    the offset to check, null returns false

    returns

    true if the offset date-time is valid for these rules

  12. abstract def nextTransition(instant: Instant): ZoneOffsetTransition

    Permalink

    Gets the next transition after the specified instant.

    Gets the next transition after the specified instant.

    This returns details of the next transition after the specified instant. For example, if the instant represents a point where "Summer" daylight savings time applies, then the method will return the transition to the next "Winter" time.

    instant

    the instant to get the next transition after, not null, but null may be ignored if the rules have a single offset for all instants

    returns

    the next transition after the specified instant, null if this is after the last transition

  13. abstract def previousTransition(instant: Instant): ZoneOffsetTransition

    Permalink

    Gets the previous transition before the specified instant.

    Gets the previous transition before the specified instant.

    This returns details of the previous transition after the specified instant. For example, if the instant represents a point where "summer" daylight saving time applies, then the method will return the transition from the previous "winter" time.

    instant

    the instant to get the previous transition after, not null, but null may be ignored if the rules have a single offset for all instants

    returns

    the previous transition after the specified instant, null if this is before the first transition

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  13. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  14. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  15. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  16. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped