Java tutorial
//package com.java2s; import java.util.TimeZone; public class Main { public static String getTimeZoneOffset() { TimeZone timezone = TimeZone.getDefault(); int i = timezone.getRawOffset() / 1000; int j; double d; Object aobj[]; if (timezone.useDaylightTime() && timezone.inDaylightTime(new java.sql.Date(System.currentTimeMillis()))) j = 1; else j = 0; d = (double) i / 3600D + (double) j; aobj = new Object[1]; aobj[0] = Double.valueOf(d); return String.format("%.2f", aobj); } }