Java Parse RFC Date parseRfc822Date(String dateString)

Here you can find the source of parseRfc822Date(String dateString)

Description

parse Rfc Date

License

Apache License

Declaration

public static Date parseRfc822Date(String dateString) throws ParseException 

Method Source Code


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

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.SimpleTimeZone;

public class Main {
    private static final String RFC822_DATE_FORMAT = "EEE, dd MMM yyyy HH:mm:ss z";

    public static Date parseRfc822Date(String dateString) throws ParseException {
        return getRfc822DateFormat().parse(dateString);
    }/*from w  w w.  ja  v  a  2s  .  c  o m*/

    private static DateFormat getRfc822DateFormat() {
        SimpleDateFormat rfc822DateFormat = new SimpleDateFormat(RFC822_DATE_FORMAT, Locale.US);
        rfc822DateFormat.setTimeZone(new SimpleTimeZone(0, "GMT"));
        return rfc822DateFormat;
    }
}

Related

  1. parseRFC3339Date(String datestring)
  2. parseRFC3339Date(String datestring)
  3. parseRFC822(String dateString)
  4. parseRFC822(String sDate, Locale locale)
  5. parseRFC822(String str)
  6. parseRfc822Date(String dt)
  7. parseRFC822Date(String value)
  8. parseRfc822DateTime(String datestr)