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 determine in Java if the current date is in daylight savings time so I can apply the correct offset. Currently I am only performing this calculation for U.S. timezones although eventually I would like to expand this to global timezones as well.
Java – Determine Whether Daylight Savings Time (DST) is Active in Java for a Specified Date
datetimeoffsetdstjava
Best Answer
This is the answer for the machine on which the question is being asked:
A server trying to figure this out for a client will need the client's time zone. See @Powerlord answer for the reason why.
For any particular TimeZone