Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.http.util
Class DateUtils  view DateUtils download DateUtils.java

java.lang.Object
  extended byorg.apache.http.util.DateUtils

public class DateUtils
extends java.lang.Object

A utility class for parsing and formatting HTTP dates as used in cookies and other headers. This class handles dates as defined by RFC 2616 section 3.3.1 as well as some other common non-standard formats.


Field Summary
private static java.lang.String[] DEFAULT_PATTERNS
           
private static java.util.Date DEFAULT_TWO_DIGIT_YEAR_START
           
static java.util.TimeZone GMT
           
static java.lang.String PATTERN_ASCTIME
          Date format pattern used to parse HTTP date headers in ANSI C asctime() format.
static java.lang.String PATTERN_RFC1036
          Date format pattern used to parse HTTP date headers in RFC 1036 format.
static java.lang.String PATTERN_RFC1123
          Date format pattern used to parse HTTP date headers in RFC 1123 format.
 
Constructor Summary
private DateUtils()
          This class should not be instantiated.
 
Method Summary
static java.lang.String formatDate(java.util.Date date)
          Formats the given date according to the RFC 1123 pattern.
static java.lang.String formatDate(java.util.Date date, java.lang.String pattern)
          Formats the given date according to the specified pattern.
static java.util.Date parseDate(java.lang.String dateValue)
          Parses a date value.
static java.util.Date parseDate(java.lang.String dateValue, java.lang.String[] dateFormats)
          Parses the date value using the given date formats.
static java.util.Date parseDate(java.lang.String dateValue, java.lang.String[] dateFormats, java.util.Date startDate)
          Parses the date value using the given date formats.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATTERN_RFC1123

public static final java.lang.String PATTERN_RFC1123
Date format pattern used to parse HTTP date headers in RFC 1123 format.

See Also:
Constant Field Values

PATTERN_RFC1036

public static final java.lang.String PATTERN_RFC1036
Date format pattern used to parse HTTP date headers in RFC 1036 format.

See Also:
Constant Field Values

PATTERN_ASCTIME

public static final java.lang.String PATTERN_ASCTIME
Date format pattern used to parse HTTP date headers in ANSI C asctime() format.

See Also:
Constant Field Values

DEFAULT_PATTERNS

private static final java.lang.String[] DEFAULT_PATTERNS

DEFAULT_TWO_DIGIT_YEAR_START

private static final java.util.Date DEFAULT_TWO_DIGIT_YEAR_START

GMT

public static final java.util.TimeZone GMT
Constructor Detail

DateUtils

private DateUtils()
This class should not be instantiated.

Method Detail

parseDate

public static java.util.Date parseDate(java.lang.String dateValue)
                                throws DateParseException
Parses a date value. The formats used for parsing the date value are retrieved from the default http params.


parseDate

public static java.util.Date parseDate(java.lang.String dateValue,
                                       java.lang.String[] dateFormats)
                                throws DateParseException
Parses the date value using the given date formats.


parseDate

public static java.util.Date parseDate(java.lang.String dateValue,
                                       java.lang.String[] dateFormats,
                                       java.util.Date startDate)
                                throws DateParseException
Parses the date value using the given date formats.


formatDate

public static java.lang.String formatDate(java.util.Date date)
Formats the given date according to the RFC 1123 pattern.


formatDate

public static java.lang.String formatDate(java.util.Date date,
                                          java.lang.String pattern)
Formats the given date according to the specified pattern. The pattern must conform to that used by the simple date format class.