How to ask a java.time.ZonedDateTime
object if Daylight Saving Time (DST) applies to its moment or if standard time applies?
Asked
Active
Viewed 394 times
3

Basil Bourque
- 303,325
- 100
- 852
- 1,154
1 Answers
4
@Jon's answer is good. Just want to mention there is ZoneRules#isDaylightSavings available.
ZonedDateTime zdt = ...;
ZoneRules rules = zdt.getZone().getRules();
boolean isDst = rules.isDaylightSavings(zdt.toInstant());
And possible duplicate question here.
-
I looked on ZonedDateTime, ZoneId and ZoneOffset, but failed to do so on ZoneRules. Doh. – Jon Skeet Nov 04 '16 at 21:15
-
@JonSkeet I just Googled "ZonedDateTime isDaylightSaving"...and I got lucky :) – Terry Li Nov 04 '16 at 21:20