Here you can find the source of getMillisFromRFC822String(Object rfc822)
Parameter | Description |
---|---|
rfc822 | An rfc 822 (section 5) date-time string. |
Parameter | Description |
---|---|
ParseException | if the date could not be parsed. |
public static Long getMillisFromRFC822String(Object rfc822) throws ParseException
//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()); } }