# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Methods | Inherited Methods

# ZoneOffsetTransition

`public final class ZoneOffsetTransition`
`extends Object` `implements Comparable<ZoneOffsetTransition>, Serializable`

java.lang.Object
↳ | java.time.zone.ZoneOffsetTransition

A transition between two offsets caused by a discontinuity in the local time-line.

A transition between two offsets is normally the result of a daylight savings cutover. The discontinuity is normally a gap in spring and an overlap in autumn. `ZoneOffsetTransition` models the transition between the two offsets.

Gaps occur where there are local date-times that simply do not exist. An example would be when the offset changes from `+03:00` to `+04:00`. This might be described as 'the clocks will move forward one hour tonight at 1am'.

Overlaps occur where there are local date-times that exist twice. An example would be when the offset changes from `+04:00` to `+03:00`. This might be described as 'the clocks will move back one hour tonight at 2am'.

## Summary

### Public methods
`int` | `compareTo(ZoneOffsetTransition transition)` Compares this transition to another based on the transition instant.
`boolean` | `equals(Object other)` Checks if this object equals another.
`LocalDateTime` | `getDateTimeAfter()` Gets the local transition date-time, as would be expressed with the 'after' offset.
`LocalDateTime` | `getDateTimeBefore()` Gets the local transition date-time, as would be expressed with the 'before' offset.
`Duration` | `getDuration()` Gets the duration of the transition.
`Instant` | `getInstant()` Gets the transition instant.
`ZoneOffset` | `getOffsetAfter()` Gets the offset after the transition.
`ZoneOffset` | `getOffsetBefore()` Gets the offset before the transition.
`int` | `hashCode()` Returns a suitable hash code.
`boolean` | `isGap()` Does this transition represent a gap in the local time-line.
`boolean` | `isOverlap()` Does this transition represent an overlap in the local time-line.
`boolean` | `isValidOffset(ZoneOffset offset)` Checks if the specified offset is valid during this transition.
`static ZoneOffsetTransition` | `of(LocalDateTime transition, ZoneOffset offsetBefore, ZoneOffset offsetAfter)` Obtains an instance defining a transition between two offsets.
`long` | `toEpochSecond()` Gets the transition instant as an epoch second.
`String` | `toString()` Returns a string describing this object.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.
From interface `java.lang.Comparable`
`abstract int` | `compareTo(ZoneOffsetTransition o)` Compares this object with the specified object for order.

## Public methods

### compareTo

    public int compareTo (ZoneOffsetTransition transition)

Compares this transition to another based on the transition instant.

This compares the instants of each transition. The offsets are ignored, making this order inconsistent with equals.

Parameters
`transition` | `ZoneOffsetTransition`: the transition to compare to, not null

Returns
`int` | the comparator value, negative if less, positive if greater

### equals

    public boolean equals (Object other)

Checks if this object equals another.

The entire state of the object is compared.

Parameters
`other` | `Object`: the other object to compare to, null returns false

Returns
`boolean` | true if equal

### getDateTimeAfter

    public LocalDateTime getDateTimeAfter ()

Gets the local transition date-time, as would be expressed with the 'after' offset.

This is the first date-time after the discontinuity, when the new offset applies.

The combination of the 'before' date-time and offset represents the same instant as the 'after' date-time and offset.

Returns
`LocalDateTime` | the transition date-time expressed with the after offset, not null

### getDateTimeBefore

    public LocalDateTime getDateTimeBefore ()

Gets the local transition date-time, as would be expressed with the 'before' offset.

This is the date-time where the discontinuity begins expressed with the 'before' offset. At this instant, the 'after' offset is actually used, therefore the combination of this date-time and the 'before' offset will never occur.

The combination of the 'before' date-time and offset represents the same instant as the 'after' date-time and offset.

Returns
`LocalDateTime` | the transition date-time expressed with the before offset, not null

### getDuration

    public Duration getDuration ()

Gets the duration of the transition.

In most cases, the transition duration is one hour, however this is not always the case. The duration will be positive for a gap and negative for an overlap. Time-zones are second-based, so the nanosecond part of the duration will be zero.

Returns
`Duration` | the duration of the transition, positive for gaps, negative for overlaps

### getInstant

    public Instant getInstant ()

Gets the transition instant.

This is the instant of the discontinuity, which is defined as the first instant that the 'after' offset applies.

The methods `getInstant()`, `getDateTimeBefore()` and `getDateTimeAfter()` all represent the same instant.

Returns
`Instant` | the transition instant, not null

### getOffsetAfter

    public ZoneOffset getOffsetAfter ()

Gets the offset after the transition.

This is the offset in use on and after the instant of the transition.

Returns
`ZoneOffset` | the offset after the transition, not null

### getOffsetBefore

    public ZoneOffset getOffsetBefore ()

Gets the offset before the transition.

This is the offset in use before the instant of the transition.

Returns
`ZoneOffset` | the offset before the transition, not null

### hashCode

    public int hashCode ()

Returns a suitable hash code.

Returns
`int` | the hash code

### isGap

    public boolean isGap ()

Does this transition represent a gap in the local time-line.

Gaps occur where there are local date-times that simply do not exist. An example would be when the offset changes from `+01:00` to `+02:00`. This might be described as 'the clocks will move forward one hour tonight at 1am'.

Returns
`boolean` | true if this transition is a gap, false if it is an overlap

### isOverlap

    public boolean isOverlap ()

Does this transition represent an overlap in the local time-line.

Overlaps occur where there are local date-times that exist twice. An example would be when the offset changes from `+02:00` to `+01:00`. This might be described as 'the clocks will move back one hour tonight at 2am'.

Returns
`boolean` | true if this transition is an overlap, false if it is a gap

### isValidOffset

    public boolean isValidOffset (ZoneOffset offset)

Checks if the specified offset is valid during this transition.

This checks to see if the given offset will be valid at some point in the transition. A gap will always return false. An overlap will return true if the offset is either the before or after offset.

Parameters
`offset` | `ZoneOffset`: the offset to check, null returns false

Returns
`boolean` | true if the offset is valid during the transition

### of

    public static ZoneOffsetTransition of (LocalDateTime transition,
                    ZoneOffset offsetBefore,
                    ZoneOffset offsetAfter)

Obtains an instance defining a transition between two offsets.

Applications should normally obtain an instance from `ZoneRules`. This factory is only intended for use when creating `ZoneRules`.

Parameters
`transition` | `LocalDateTime`: the transition date-time at the transition, which never actually occurs, expressed local to the before offset, not null
`offsetBefore` | `ZoneOffset`: the offset before the transition, not null
`offsetAfter` | `ZoneOffset`: the offset at and after the transition, not null

Returns
`ZoneOffsetTransition` | the transition, not null

Throws
`IllegalArgumentException` | if `offsetBefore` and `offsetAfter` are equal, or `transition.getNano()` returns non-zero value

### toEpochSecond

    public long toEpochSecond ()

Gets the transition instant as an epoch second.

Returns
`long` | the transition epoch second

### toString

    public String toString ()

Returns a string describing this object.

Returns
`String` | a string for debugging, not null

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*