Java Date Time - ZonedDateTime withEarlierOffsetAtOverlap() example








ZonedDateTime withEarlierOffsetAtOverlap() returns a copy of this date-time changing the zone offset to the earlier of the two valid offsets at a local time-line overlap.

Syntax

withEarlierOffsetAtOverlap has the following syntax.

public ZonedDateTime withEarlierOffsetAtOverlap()

Example

The following example shows how to use withEarlierOffsetAtOverlap.

import java.time.ZonedDateTime;

public class Main {
  public static void main(String[] args) {
    ZonedDateTime dateTime =ZonedDateTime.now();
    ZonedDateTime l =dateTime.withEarlierOffsetAtOverlap() ;
    System.out.println(l);
  } 
}

The code above generates the following result.