Interrogate the ZonedDateTime query if during standard time or summer time (DST)

How to set an object java.time.ZonedDateTimeif Daylight Saving Time (DST) or its standard time is applied?

+4
source share
1 answer

@Good answer. Just want to mention that there are ZoneRules # isDaylightSavings .

ZonedDateTime zdt = ...;
ZoneRules rules = zdt.getZone().getRules();
boolean isDst = rules.isDaylightSavings(zdt.toInstant());

And a possible duplicate question is here .

+4
source

Source: https://habr.com/ru/post/1659870/


All Articles