Java Time in GMT getGMTDate()

Here you can find the source of getGMTDate()

Description

get GMT Date

License

Apache License

Declaration

public static String getGMTDate() 

Method Source Code

//package com.java2s;
// Licensed to the Apache Software Foundation (ASF) under one

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

public class Main {
    public static String getGMTDate() {
        SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss 'GMT'", Locale.US);
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
        return sdf.format(new Date());
    }//  ww  w  . j a  v  a 2  s. c  om

    public static String getGMTDate(Date date) {
        SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss 'GMT'", Locale.US);
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
        return sdf.format(date);
    }
}

Related

  1. getGMT(Date date)
  2. getGMT8Time()
  3. getGMTByDisplay(String tm)
  4. getGMTCalendarAtTime(String sTime)
  5. getGMTDateFormat(String format)
  6. getGMTDateFormat(String strFormat)
  7. getGMTDateString(Date date)
  8. getGMTDatetime(Date datetime)