Java Date RFC Format getRFC822Date()

Here you can find the source of getRFC822Date()

Description

Get the RFC822-compliant representation of the current time

License

Open Source License

Return

the formatted String

Declaration

public static String getRFC822Date() 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static final String MAIL_FORMAT_STR = "EEE, d MMM yyyy HH:mm:ss Z";

    /**//from   w  w  w  .j av a  2s .  c  o m
     * Get the RFC822-compliant representation of the current time
     * 
     * @return the formatted String
     */
    public static String getRFC822Date() {
        return getRFC822Date(new Date());
    }

    /**
     * Get the RFC822-compliant representation of the given Date
     * 
     * @param d
     *            the date
     * @return the formatted String
     */
    public static String getRFC822Date(Date d) {
        return new SimpleDateFormat(MAIL_FORMAT_STR).format(d);
    }
}

Related

  1. getRFC822()
  2. getRFC822String(Date date)
  3. getRfc822DateFormat()
  4. getRFC3339String(Calendar timestamp)
  5. getRFC1123Date()
  6. getRfc1123DateFormat()
  7. getRfc822DateFormat()
  8. getRFC2616Date(Date date)
  9. getRfc822DateStringGMT(Date date)