Here you can find the source of getGMTString(Date date, TimeZone tz)
private static String getGMTString(Date date, TimeZone tz)
//package com.java2s; import java.text.DecimalFormat; import java.util.Date; import java.util.TimeZone; public class Main { private static String getGMTString(Date date, TimeZone tz) { DecimalFormat fmt = new DecimalFormat("'GMT'+00':00';'GMT'-00':00'"); int off = tz.getRawOffset(); if (tz.inDaylightTime(date)) off += 3600000;/*from www.j a va 2s .c o m*/ off = off / 3600000; return fmt.format(off); } }