java – 询问ZonedDateTime询问是否在标准时间或夏令时(DST)

参见英文答案 > Java8 – how to know if daylight savings is on now                                    1个
如果夏令时(DST)适用于当时或标准时间适用,如何询问java.time.ZonedDateTime对象?

解决方法:

@ Jon的回答很好.只想提一下有ZoneRules#isDaylightSavings可用.

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

可能重复的问题here.

上一篇:ERROR: Failed to resolve: support-compat Affected Modules: app


下一篇:文件上传-[极客大挑战 2019]Upload 1