Package org.apache.nutch.net.protocols

# Class HttpDateFormat

java.lang.Object
org.apache.nutch.net.protocols.HttpDateFormat

public class HttpDateFormat extends Object
Parse and format HTTP dates in HTTP headers, e.g., used to fill the "If-Modified-Since" request header field. HTTP dates use Greenwich Mean Time (GMT) as time zone and a date format like:

     Sun, 06 Nov 1994 08:49:37 GMT

See sec. 3.3.1 in RFC 2616 and sec. 7.1.1.1 in RFC 7231.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final DateTimeFormatter`
  `FORMAT`
  `static final DateTimeFormatter`
  `PARSE_FORMAT`
  Use a less restrictive format for parsing: accept single-digit day-of-month and any timezone

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `HttpDateFormat()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `main(String[] args)`
  `static Date`
  `toDate(String dateString)`
  `static long`
  `toLong(String dateString)`
  `static String`
  `toString(long millis)`
  `static String`
  `toString(Calendar cal)`
  `static String`
  `toString(Date date)`
  Get the HTTP format of the specified date.
  `static ZonedDateTime`
  `toZonedDateTime(String dateString)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### FORMAT

    public static final DateTimeFormatter FORMAT

  - ### PARSE_FORMAT

    public static final DateTimeFormatter PARSE_FORMAT
    Use a less restrictive format for parsing: accept single-digit day-of-month and any timezone

- ## Constructor Details

  - ### HttpDateFormat

    public HttpDateFormat()

- ## Method Details

  - ### toString

    public static String toString(Date date)
    Get the HTTP format of the specified date.
    Parameters:
      `date` - a `Date` for conversion
    Returns:
      the String HTTP representation of the date

  - ### toString

    public static String toString(Calendar cal)

  - ### toString

    public static String toString(long millis)

  - ### toZonedDateTime

    public static ZonedDateTime toZonedDateTime(String dateString) throws ParseException
    Throws:
      `ParseException`

  - ### toDate

    public static Date toDate(String dateString) throws ParseException
    Throws:
      `ParseException`

  - ### toLong

    public static long toLong(String dateString) throws ParseException
    Throws:
      `ParseException`

  - ### main

    public static void main(String[] args) throws Exception
    Throws:
      `Exception`