ZonedDateTime
doesn't seem to allow to detect if the date given is in a DST gap or overlap. The docs say for the of
method (creating a ZonedDateTime
):
In the case of an overlap, when clocks are set back, there are two valid offsets. This method uses the earlier offset typically corresponding to "summer".
In the case of a gap, when clocks jump forward, there is no valid offset. Instead, the local date-time is adjusted to be later by the length of the gap.
^ as read above, this method will just return a value but will not allow me to know if a DST gap or overlap occurs.
I would like to know if the date provided is in a gap or overlap, and have the starting date and ending date of the gap or overlap.
For example:
"1920-09-01 00:10" for time zone "Africa/Accra" is in a DST gap.
The gap is from "1920-09-01 00:00:00+00:00" to "1920-09-01 00:20:00+00:20".
"1920-12-30 23:50" for time zone "Africa/Accra" is in a DST overlap.
The overlap concerns the periods:
"1920-12-30 23:40:00+00:20" to "1920-12-31 00:00:00+00:20" and
"1920-12-30 23:40:00+00:00" to "1920-12-31 00:00:00+00:00"
How can I get these dates in case of a gap or overlap as in the examples above?