I’m working on an application where I need to maintain times from different location. I’m using Date, Timezone classes in Java. My question is – does the Timezone class know details about the Daylight Savings Time? Like if the Timezone is passed some time zone, does it return the correct time considering DST?
EDIT:
Follow up – Why is inDaylightTime() implemented as abstract and can only be used with SimpleTimeZone where you specify the start/end daylight times?
Yes, the JVM’s date classes are timezone aware.
The DST information for TimeZones is regularly updated by governments and the JVM needs to be updated accordingly if your application performs cross-timezone calculations. Oracle release updates for JVMs when this changes. See Timezones, Daylight Savings, and the Sun TZupdater for the Java Runtime Environment (JRE)
In my experience the core Java classes for dealing with this problem are very difficult to use. I get better results from Joda Time. (Joda-Time also honours the underlying timezone information).