Here you can find the source of getDateFromRFC822String(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 Date getDateFromRFC822String(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 { /**//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()); } }