org.apache.solr.handler.extraction

## Class ExtractionDateUtil

- java.lang.Object
- - org.apache.solr.handler.extraction.ExtractionDateUtil

-     public class ExtractionDateUtil
      extends Object

  This class has some code from HttpClient DateUtil.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Collection<String>` | `DEFAULT_DATE_FORMATS` A suite of default date formats that can be parsed, and thus transformed to the Solr specific format
    `static DateTimeFormatter` | `ISO_8601_PARSER` Differs by `DateTimeFormatter.ISO_INSTANT` in that it's lenient.
    `static String` | `PATTERN_ASCTIME` Date format pattern used to parse HTTP date headers in ANSI C `asctime()` format.
    `static String` | `PATTERN_RFC1036` Date format pattern used to parse HTTP date headers in RFC 1036 format.
    `static String` | `PATTERN_RFC1123` Date format pattern used to parse HTTP date headers in RFC 1123 format.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExtractionDateUtil()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Date` | `parseDate(String d)` Returns a formatter that can be use by the current thread if needed to convert Date objects to the Internal representation.
    `static Date` | `parseDate(String d, Collection<String> fmts)`
    `static Date` | `parseDate(String dateValue, Collection<String> dateFormats, Date startDate)` Slightly modified from org.apache.commons.httpclient.util.DateUtil.parseDate

    - ### 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 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 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 String PATTERN_ASCTIME

      Date format pattern used to parse HTTP date headers in ANSI C `asctime()` format.
      See Also:
        Constant Field Values

    - #### ISO_8601_PARSER

          public static final DateTimeFormatter ISO_8601_PARSER

      Differs by `DateTimeFormatter.ISO_INSTANT` in that it's lenient.

    - #### DEFAULT_DATE_FORMATS

          public static final Collection<String> DEFAULT_DATE_FORMATS

      A suite of default date formats that can be parsed, and thus transformed to the Solr specific format

  - ### Constructor Detail

    - #### ExtractionDateUtil

          public ExtractionDateUtil()

  - ### Method Detail

    - #### parseDate

          public static Date parseDate(String d)
                                throws ParseException

      Returns a formatter that can be use by the current thread if needed to convert Date objects to the Internal representation.
      Parameters:
        `d` - The input date to parse
      Returns:
        The parsed `Date`
      Throws:
        `ParseException` - If the input can't be parsed

    - #### parseDate

          public static Date parseDate(String d,
                                       Collection<String> fmts)
                                throws ParseException

      Throws:
        `ParseException`

    - #### parseDate

          public static Date parseDate(String dateValue,
                                       Collection<String> dateFormats,
                                       Date startDate)
                                throws ParseException

      Slightly modified from org.apache.commons.httpclient.util.DateUtil.parseDate

      Parses the date value using the given date formats.

      Parameters:
        `dateValue` - the date value to parse
        `dateFormats` - the date formats to use
        `startDate` - During parsing, two digit years will be placed in the range `startDate` to `startDate + 100 years`. This value may be `null`. When `null` is given as a parameter, year `2000` will be used.
      Returns:
        the parsed date
      Throws:
        `ParseException` - if none of the dataFormats could parse the dateValue

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.