Java Date GMT Format formatGmtDate(Date date)

Here you can find the source of formatGmtDate(Date date)

Description

format Gmt Date

License

Apache License

Declaration

public static String formatGmtDate(Date date) 

Method Source Code

//package com.java2s;
// | Licensed under the Apache License, Version 2.0 (the "License");

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.Locale;

import java.util.TimeZone;

public class Main {
    private static final String GMT_DATE_FORMAT = "EEE, dd MMM yyyy HH:mm:ss z";

    public static String formatGmtDate(Date date) {
        SimpleDateFormat df = new SimpleDateFormat(GMT_DATE_FORMAT,
                Locale.US);//from   w w w . j a v  a 2s  .  c  om
        df.setTimeZone(TimeZone.getTimeZone("GMT"));
        return df.format(date);
    }
}

Related

  1. formatDateTimeGMT(Date date)
  2. formatGMT(Date date)
  3. formatGMT(Date date, String parttern)
  4. formatGMTDate(Date gmtTime, int offset)
  5. getDefaultID2GMT()
  6. getFormattedGMTDate(long timestamp)
  7. getNewGmtSimpleDateFormat(String format)