Here you can find the source of formatGMT(Date date, String parttern)
public static String formatGMT(Date date, String parttern)
//package com.java2s; //License from project: LGPL import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; public class Main { private static final TimeZone GMT = TimeZone.getTimeZone("GMT"); public static String formatGMT(Date date, String parttern) { if (date == null) { return ""; }/*from ww w .j av a 2s. c o m*/ if (parttern == null || parttern.equals("")) { return ""; } SimpleDateFormat formater = new SimpleDateFormat(parttern, Locale.ENGLISH); formater.setTimeZone(GMT); return formater.format(date); } public static String format(Date date, String parttern) { if (date == null) { return ""; } if (parttern == null || parttern.equals("")) { return ""; } SimpleDateFormat formater = new SimpleDateFormat(parttern, Locale.ENGLISH); return formater.format(date); } }