Here you can find the source of getCurrentTimezoneOffset()
public static String getCurrentTimezoneOffset()
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static String getCurrentTimezoneOffset() { TimeZone tz = TimeZone.getDefault(); Calendar cal = GregorianCalendar.getInstance(tz); int offsetInMillis = tz.getOffset(cal.getTimeInMillis()); String offset = String.format("%02d:%02d", Math.abs(offsetInMillis / 3600000), Math.abs((offsetInMillis / 60000) % 60)); offset = (offsetInMillis >= 0 ? "+" : "-") + offset; return offset; }//from ww w.ja v a2 s . com }