Here you can find the source of getGMTDate()
public static String getGMTDate()
//package com.java2s; /**// w w w. j a v a 2 s. c om * Copyright (c) 2012 The Wiseserc. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; public class Main { public static String getGMTDate() { return getGMTDate(new Date()); } public static String getGMTDate(Date date) { if (date == null) { return null; } DateFormat dateFormat = new SimpleDateFormat( "E, dd MMM yyyy HH:mm:ss 'GMT'", Locale.ENGLISH); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); String dateStr = dateFormat.format(date); return dateStr; } }