Java Date Parse getDateFromRFC822String(Object rfc822)

Here you can find the source of getDateFromRFC822String(Object rfc822)

Description

FIX: In order to make EPL nested calls, we need this guy to be able to accept Object which is a string actually

License

MIT License

Parameter

Parameter Description
rfc822 An rfc 822 (section 5) date-time string.

Exception

Parameter Description
ParseException if the date could not be parsed.

Return

the Unix epoch date-time for the given RFC 822 date-time string.

Declaration

public static Date getDateFromRFC822String(Object rfc822) throws ParseException 

Method Source Code

//package com.java2s;
/*******************************************************************************
 *  Copyright ? 2012-2015 eBay Software Foundation
 *  This program is dual licensed under the MIT and Apache 2.0 licenses.
 *  Please see LICENSE for more information.
 *******************************************************************************/

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /**//w w  w.  ja v a2s.  co m
     * 
     * FIX: In order to make EPL nested calls, we need this guy to be able to accept Object which is a string actually
     * 
     * @param rfc822
     *          An rfc 822 (section 5) date-time string.
     * 
     * @return the Unix epoch date-time for the given RFC 822 date-time string.
     * 
     * @throws ParseException
     *           if the date could not be parsed.
     */
    public static Date getDateFromRFC822String(Object rfc822) throws ParseException {
        return rfc822 == null ? null
                : new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy").parse(rfc822.toString());
    }
}

Related

  1. getDateFromISOString(String iso)
  2. getDateFromOffset(Date prevDate, int offset)
  3. getDateFromOriDateStr(String strDate)
  4. getDateFromRange(String date)
  5. getDateFromRequestStringDate(String dateString)
  6. getDateFromStr(DateFormat format, String s)
  7. getDateFromStr(String date)
  8. getDateFromStr(String inputDate, String inputFormatStr)
  9. getDateFromString(final String dateStr, final String pattern)