Java Date RFC Format getRfc822DateStringGMT(Date date)

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

Description

get Rfc Date String GMT

License

Apache License

Declaration

public static final String getRfc822DateStringGMT(Date date) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public static SimpleDateFormat RFC_822_ZONE_LESS_FORMAT = new SimpleDateFormat(
            "EEE', 'dd' 'MMM' 'yyyy' 'HH:mm:ss", Locale.US);

    public static final String getRfc822DateStringGMT(Date date) {

        String pattern = RFC_822_ZONE_LESS_FORMAT.toPattern();
        SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.US);
        StringBuilder r = new StringBuilder();

        format.setTimeZone(TimeZone.getTimeZone("GMT"));

        r.append(format.format(date));//w ww .  j  ava2s  .com
        r.append(" GMT");

        return r.toString();

    }
}

Related

  1. getRFC3339String(Calendar timestamp)
  2. getRFC822()
  3. getRFC822Date()
  4. getRfc822DateFormat()
  5. getRfc822DateFormat()
  6. getRFC822String(Date date)
  7. makeDateRFC2822(Date date)
  8. renderDateAsRFC822String(Date date)
  9. resolvedDateRFC822(String pString)