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 and Description
    --- | ---
    `protected static SimpleDateFormat` | `format`
    `protected static TimeZone` | `gmt`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpDateFormat()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `main(String[] args)`
    `static Date` | `toDate(String dateString)`
    `static long` | `toLong(String dateString)`
    `static String` | `toString(Calendar cal)`
    `static String` | `toString(Date date)` Get the HTTP format of the specified date.
    `static String` | `toString(long time)`

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

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

- - ### Field Detail

    - #### format

          protected static SimpleDateFormat format

    - #### gmt

          protected static TimeZone gmt

  - ### Constructor Detail

    - #### HttpDateFormat

          public HttpDateFormat()

  - ### Method Detail

    - #### toString

          public static String toString(Date date)

      Get the HTTP format of the specified date.

    - #### toString

          public static String toString(Calendar cal)

    - #### toString

          public static String toString(long time)

    - #### 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`

Copyright © 2021 The Apache Software Foundation