Here you can find the source of getTimezoneOffset(TimeZone timeZone)
public static String getTimezoneOffset(TimeZone timeZone)
//package com.java2s; //License from project: Apache License import java.util.TimeZone; import java.util.concurrent.TimeUnit; public class Main { public static String getTimezoneOffset(TimeZone timeZone) { long hours = TimeUnit.MILLISECONDS.toHours(timeZone.getRawOffset()); long minutes = TimeUnit.MILLISECONDS.toMinutes(timeZone.getRawOffset()) - TimeUnit.HOURS.toMinutes(hours); minutes = Math.abs(minutes); String result = ""; if (hours > 0) { result = String.format("GMT+%d:%02d %s", hours, minutes, timeZone.getID()); } else {/*from ww w . j av a 2 s .c o m*/ result = String.format("GMT%d:%02d %s", hours, minutes, timeZone.getID()); } return result; } }