Java Time in GMT getGMTDateString(Date date)

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

Description

get GMT Date String

License

Open Source License

Declaration

public static String getGMTDateString(Date date) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.text.DateFormat;
import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.TimeZone;

public class Main {
    public static String getGMTDateString(Date date) {
        SimpleDateFormat formatter = (SimpleDateFormat) DateFormat.getDateInstance();
        TimeZone gmt = TimeZone.getTimeZone("GMT");
        formatter.setTimeZone(gmt);/*from  www  . j  a  va  2 s . com*/
        formatter.applyPattern("dd MMMM");
        String dayString = formatter.format(date);
        formatter = (SimpleDateFormat) DateFormat.getTimeInstance();
        formatter.setTimeZone(gmt);
        formatter.applyPattern("hh:mm zzz yyyy");
        String timeString = formatter.format(date);
        return dayString + " at " + timeString;
    }
}

Related

  1. getGMTByDisplay(String tm)
  2. getGMTCalendarAtTime(String sTime)
  3. getGMTDate()
  4. getGMTDateFormat(String format)
  5. getGMTDateFormat(String strFormat)
  6. getGMTDatetime(Date datetime)
  7. getGMTDatetimeFormat()
  8. getGmtFromTimeInMillis(String val)
  9. getGMTime()