Java Time in GMT getGMTString(Date date, TimeZone tz)

Here you can find the source of getGMTString(Date date, TimeZone tz)

Description

get GMT String

License

Open Source License

Declaration

private static String getGMTString(Date date, TimeZone tz) 

Method Source Code


//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);
    }
}

Related

  1. getGMTDatetimeFormat()
  2. getGmtFromTimeInMillis(String val)
  3. getGMTime()
  4. getGMTime()
  5. getGMTString(Date d)
  6. getGMTTime(Date localTime)
  7. getGMTTime(final Date date)
  8. getGMTTimeStr(Date pageTime, int offset)
  9. getGmtTimeString(double startTime)