Class MailDateParser

java.lang.Object
org.apache.tika.parser.mailcommons.MailDateParser

@Deprecated(since="4.2.0", forRemoval=true) public class MailDateParser extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
since 4.2.0, removed in 4.3.0; use TikaDates.
Dates in emails are a mess. There are at least two major date related bugs in JDK 8. And, I've found differing behavior, bug or not, between JDK 8 and JDK 11/17. This class does its best to parse date strings. It does have a US-based date bias. Please open a ticket to fix this as needed. We can also add overrides via the parser config to manage customization of date formats. This code does not spark joy especially given the diffs in behavior between jdk versions. At some point, we should probably try joda or, heaven forfend, a pile of regexes.
  • Field Details

    • RFC_5322

      public static final DateTimeFormatter RFC_5322
      Deprecated, for removal: This API element is subject to removal in a future version.
    • RFC_5322_LENIENT

      public static final DateTimeFormatter RFC_5322_LENIENT
      Deprecated, for removal: This API element is subject to removal in a future version.
    • RFC_5322_AMPM_LENIENT

      public static final DateTimeFormatter RFC_5322_AMPM_LENIENT
      Deprecated, for removal: This API element is subject to removal in a future version.
    • MMM_D_YYYY_HH_MM_AM_PM

      public static final DateTimeFormatter MMM_D_YYYY_HH_MM_AM_PM
      Deprecated, for removal: This API element is subject to removal in a future version.
    • MMM_D_YYYY_HH_MM

      public static final DateTimeFormatter MMM_D_YYYY_HH_MM
      Deprecated, for removal: This API element is subject to removal in a future version.
    • MM_SLASH_DD_SLASH_YY_HH_MM

      public static final DateTimeFormatter MM_SLASH_DD_SLASH_YY_HH_MM
      Deprecated, for removal: This API element is subject to removal in a future version.
    • MM_SLASH_DD_SLASH_YY_HH_MM_AM_PM

      public static final DateTimeFormatter MM_SLASH_DD_SLASH_YY_HH_MM_AM_PM
      Deprecated, for removal: This API element is subject to removal in a future version.
    • YYYY_MM_DD_HH_MM

      public static final DateTimeFormatter YYYY_MM_DD_HH_MM
      Deprecated, for removal: This API element is subject to removal in a future version.
    • YYYY_MM_DD

      public static final DateTimeFormatter YYYY_MM_DD
      Deprecated, for removal: This API element is subject to removal in a future version.
    • MM_SLASH_DD_SLASH_YYYY

      public static final DateTimeFormatter MM_SLASH_DD_SLASH_YYYY
      Deprecated, for removal: This API element is subject to removal in a future version.
    • DD_SLASH_MM_SLASH_YYYY

      public static final DateTimeFormatter DD_SLASH_MM_SLASH_YYYY
      Deprecated, for removal: This API element is subject to removal in a future version.
    • MMM_DD_YY

      public static final DateTimeFormatter MMM_DD_YY
      Deprecated, for removal: This API element is subject to removal in a future version.
    • DD_MMM_YY

      public static final DateTimeFormatter DD_MMM_YY
      Deprecated, for removal: This API element is subject to removal in a future version.
    • YY_SLASH_MM_SLASH_DD

      public static final DateTimeFormatter YY_SLASH_MM_SLASH_DD
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Constructor Details

    • MailDateParser

      public MailDateParser()
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • parseRFC5322

      public static Date parseRFC5322(String string) throws ParseException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Throws:
      ParseException
    • parseDateLenient

      public static Date parseDateLenient(String text)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • normalize

      protected static String normalize(String text)
      Deprecated, for removal: This API element is subject to removal in a future version.