ChronoZonedDateTime withLaterOffsetAtOverlap() method in Java with Examples
The withLaterOffsetAtOverlap() method of a ChronoZonedDateTime interface is used to return a copy of this ChronoZonedDateTime object after changing the zone offset to the later of the two valid offsets at a local time-line overlap. The overlap happens when Daylight saving time finishes and one hour is returned to the timeline. FDue to this there are two valid offsets for the local date-time and calling withLaterOffsetAtOverlap method will return a ChronoZonedDateTime with the later of the two zones. If this method is called when it is not an overlap, this is returned. This instance is immutable and unaffected by this method call.
Parameters: This method accepts no parameters.
Return value: This method returns a ChronoZonedDateTime based on this date-time with the later offset.
Below programs illustrate the withLaterOffsetAtOverlap() method:
Before withLaterOffsetAtOverlap(): 2018-11-04T01:25:43-05:00[US/Central] After withLaterOffsetAtOverlap(): 2018-11-04T01:25:43-06:00[US/Central]
Before withLaterOffsetAtOverlap(): 2021-11-07T01:05:53-05:00[US/Central] After withLaterOffsetAtOverlap(): 2021-11-07T01:05:53-06:00[US/Central]