I am trying to convert my current date from some time zone(dynamic) to EST or EDT. Now the issue is, say if I am in IST zone, how do I know whether I need to convert to EST or EDT, as in how do I know if the day light saving is on?
Asked
Active
Viewed 196 times
1
-
1What Java version are you using? – Freiheit Sep 12 '19 at 17:47
-
https://stackoverflow.com/questions/10545960/how-to-tackle-daylight-savings-using-timezone-in-java looks similar to your question – Freiheit Sep 12 '19 at 17:48
-
1So does https://stackoverflow.com/questions/1060479/determine-whether-daylight-savings-time-dst-is-active-in-java-for-a-specified – Freiheit Sep 12 '19 at 17:49
-
2You don't actually need to know whether the timezone is in DST to convert a date. See the third duplicate. – Sweeper Sep 12 '19 at 17:56
-
1Why convert from your own current time? Just use `ZonedDateTime.now(ZoneId.of("America/Toronto"))` (or `ZonedDateTime.now(ZoneId.of("America/New_York"))`) to get the current time in (North American) EST or EDT. It will also automatically use summer time if appropriate. – Ole V.V. Sep 12 '19 at 18:12
-
Thanks @OleV.V. This helped. – user3115056 Sep 12 '19 at 22:30