Java Date GMT Format formatGMT(Date date)

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

Description

format GMT

License

Open Source License

Declaration

public static String formatGMT(Date date) throws Exception 

Method Source Code


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

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

public class Main {
    public static final TimeZone TIME_ZONE_GMT = TimeZone.getTimeZone("GMT");
    public static final String DATE_TIME_PATTERN = "yyyyMMdd-HHmm";

    public static String formatGMT(Date date) throws Exception {
        assert (date != null);

        SimpleDateFormat format = new SimpleDateFormat(DATE_TIME_PATTERN);
        format.setTimeZone(TIME_ZONE_GMT);
        return format.format(date);
    }/*from w w  w.  j  a v a 2  s . co  m*/
}

Related

  1. formatDateTimeGMT(Date date)
  2. formatGMT(Date date, String parttern)
  3. formatGmtDate(Date date)
  4. formatGMTDate(Date gmtTime, int offset)
  5. getDefaultID2GMT()