Determine Whether Daylight Savings Time (DST) is Active in Java for a Specified Date

前端 未结 5 1032
生来不讨喜
生来不讨喜 2020-11-29 04:29

I have a Java class that takes in the latitude/longitude of a location and returns the GMT offset when daylight savings time is on and off. I am looking for an easy way to

5条回答
  •  春和景丽
    2020-11-29 05:05

    TimeZone tz = TimeZone.getTimeZone("EST");
    boolean inDs = tz.inDaylightTime(new Date());
    

提交回复
热议问题