Class MailDateParser
java.lang.Object
org.apache.tika.parser.mailcommons.MailDateParser
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 Summary
Modifier and TypeFieldDescriptionstatic final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
static final DateTimeFormatter
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static String
static Date
parseDateLenient
(String text) static Date
parseRFC5322
(String string)
-
Field Details
-
RFC_5322
-
RFC_5322_LENIENT
-
RFC_5322_AMPM_LENIENT
-
MMM_D_YYYY_HH_MM_AM_PM
-
MMM_D_YYYY_HH_MM
-
MM_SLASH_DD_SLASH_YY_HH_MM
-
MM_SLASH_DD_SLASH_YY_HH_MM_AM_PM
-
YYYY_MM_DD_HH_MM
-
YYYY_MM_DD
-
MM_SLASH_DD_SLASH_YYYY
-
DD_SLASH_MM_SLASH_YYYY
-
MMM_DD_YY
-
DD_MMM_YY
-
YY_SLASH_MM_SLASH_DD
-
-
Constructor Details
-
MailDateParser
public MailDateParser()
-
-
Method Details
-
parseRFC5322
- Throws:
ParseException
-
parseDateLenient
-
normalize
-