SHOW Signed
 

net.rim.device.api.io.http
Class HttpDateParser

java.lang.Object
  |
  +--net.rim.device.api.io.http.HttpDateParser

public final class HttpDateParser
extends Object

A little utility class designed to parse dates in one of the three formats supported by HTTP 1.1. The formats are:

Note that the first format is preferred, and in fact HTTP 1.1 clients and servers MUST only generate dates in that format. However, for backwards compatibility, they MUST accept all three formats.

Sample code
 // Assuming getHeaderField() of HttpConnection interface is implemented.
 String value = getHeaderField( HttpProtocolConstants.HEADER_DATE ); 
 if (value != null) 
 {
     long parsed = HttpDateParser.parse( value );
 }
 
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.

Since:
JDE 4.0.0

Method Summary
 Category: Signed static long parse(String date)
          Parses a date string and returns the number of milliseconds since January 1, 1970, 00:00:00 GMT.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parse

public static long parse(String date)
Parses a date string and returns the number of milliseconds since January 1, 1970, 00:00:00 GMT. The date is assumed to be of the format: "Wdy, DD Mon YY" "Wdy, DD Mon YYYY" "Wdy, DD Mon YY HH:MM:SS" "Wdy, DD Mon YY HH:MM:SS GMT" "Wdy, DD Mon YY HHMMSS" "Wdy, DD Mon YY HHMMSS GMT" "Wdy, DD Mon YYYY HH:MM:SS" "Wdy, DD Mon YYYY HH:MM:SS GMT" "Wdy, DD Mon YYYY HHMMSS" "Wdy, DD Mon YYYY HHMMSS GMT" "Wdy, Mon DD YY HH:MM:SS" "Wdy, Mon DD YY HH:MM:SS GMT" "Wdy, Mon DD YY HHMMSS" "Wdy, Mon DD YY HHMMSS GMT" "Wdy, Mon DD YYYY HH:MM:SS" "Wdy, Mon DD YYYY HH:MM:SS GMT" "Wdy, Mon DD YYYY HHMMSS" "Wdy, Mon DD YYYY HHMMSS GMT" "Wdy, DD Mon YY, HH:MM:SS" "Wdy, DD Mon YY, HH:MM:SS GMT" "Wdy, DD Mon YY, HHMMSS" "Wdy, DD Mon YY, HHMMSS GMT" "Wdy, DD Mon YYYY, HH:MM:SS" "Wdy, DD Mon YYYY, HH:MM:SS GMT" "Wdy, DD-Mon-YY HH:MM:SS" "Wdy, DD-Mon-YY HH:MM:SS GMT" "Wdy, DD-Mon-YY HHMMSS" "Wdy, DD-Mon-YY HHMMSS GMT" "Wdy, DD-Mon-YY, HH:MM:SS" "Wdy, DD-Mon-YY, HH:MM:SS GMT" "Wdy, DD-Mon-YY, HHMMSS" "Wdy, DD-Mon-YY, HHMMSS GMT" "Wdy, DD-Mon-YYYY HH:MM:SS" "Wdy, DD-Mon-YYYY HH:MM:SS GMT" "Wdy, DD-Mon-YYYY HHMMSS" "Wdy, DD-Mon-YYYY HHMMSS GMT" "Wdy, DD-Mon-YYYY, HH:MM:SS" "Wdy, DD-Mon-YYYY, HH:MM:SS GMT" "Wdy, DD-Mon-YYYY, HHMMSS" "Wdy, DD-Mon-YYYY, HHMMSS GMT" "Weekday, DD-Mon-YY HH:MM:SS" "Weekday, DD-Mon-YY HH:MM:SS GMT" "Weekday, DD-Mon-YY HHMMSS" "Weekday, DD-Mon-YY HHMMSS GMT" "Weekday, DD-Mon-YYYY HH:MM:SS" "Weekday, DD-Mon-YYYY HH:MM:SS GMT" "Weekday, DD-Mon-YYYY HHMMSS" "Weekday, DD-Mon-YYYY HHMMSS GMT" "Wdy Mon DD HH:MM:SS YYYY" "YYYY" (eg 1997) "YYYY-MM" (eg 1997-07) "YYYY-MM-DD" (eg 1997-07-16) "YYYY-MM-DDThh:mmTZD" (eg 1997-07-16T19:20+01:00) "YYYY-MM-DDThh:mm:ssTZD" (eg 1997-07-16T19:20:30+01:00) "YYYY-MM-DDThh:mm:ss.sTZD" (eg 1997-07-16T19:20:30.45+01:00) When parsing a date string using the abbreviated year pattern ("YY") it must interpret the abbreviated year relative to some century. It does this by adjusting dates to be within 80 years before and 20 years after the current time.
Parameters:
date - The string to parse.
Returns:
The number of milliseconds.
Since:
JDE 4.0.0
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.



Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.