texasbruce texasbruce - 1 year ago 89
Java Question

Wrong Daylight Saving Offset Returned from Timezone Object

I have the following code:

java.util.TimeZone tz = java.util.TimeZone.getDefault();
System.out.println("Server DS Offset: " + tz.getDSTSavings());

Right now the Daylight saving is off, so I was expecting it to return 0, but it still returns 3600000.

Server is
Solaris 10

command returns:

Friday, November 11, 2016 4:27:12 PM EST



Answer Source

How about Determine whether daylight savings time dst is active

What you got in your code is TimeZone attribute about what is offset for DST. In the world some offsets are 30 min. some do not have any. So, if Timezone follows DST then you got this value.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download