Java Millisecond Current Get getMillisFromRFC822String(Object rfc822)

Here you can find the source of getMillisFromRFC822String(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 Long getMillisFromRFC822String(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 {
    /**//from   w  w  w. ja  v a 2 s . 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 Long getMillisFromRFC822String(Object rfc822) throws ParseException {
        Date rfc822Date = getDateFromRFC822String(rfc822);
        return rfc822Date == null ? null : rfc822Date.getTime();
    }

    /**
     * 
     * 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. getMillisDurationString(long millis)
  2. getMillisec_old(String isoDate)
  3. getMillisecondStamp(Date date)
  4. getMilliSecondToTomorrow(Date date)
  5. getMillisFromISO8601(Object iso8601)
  6. getMillisFromString(String s)
  7. getMillisFromYYYYMMDD(Object yyyymmdd)
  8. getMillisId()
  9. getMillisOfTowDiffDate(String p_startDate, String p_endDate)