Java8 - how to find out if daylight saving time is turned on

I need to find out if day saving is enabled using the new datetime Java time classes. I found a record on how to do this in jodatime:

jodatime how to find out if daylight is on

But how can I find out in Java 8? (jodatime should be similar, but I could not find the appropriate java.time.ZonedDateTime.isStandardOffset () method)

thanks for the help

+8
java datetime java-8
source share
1 answer

ZoneRules contains the features you are interested in:

 public static boolean isDST(ZonedDateTime t) { return t.getZone().getRules().isDaylightSavings(t.toInstant()); } 
+11
source share

All Articles