Class TikaDates

java.lang.Object
org.apache.tika.utils.TikaDates

public final class TikaDates extends Object
The one parser for date strings from documents. Each value is routed by its leading shape to a family (ISO 8601 / W3C-DTF, PDF D:, EXIF, RFC 5322 and other month-name forms, ctime, slash dates, 8/12/14-digit strings) and must match that family whole; there is no prefix matching. Thread-safe.

Rules: years outside 1000..2200 and offsets outside -12:00..+14:00 are rejected; the calendar is proleptic Gregorian as written; slash dates are month-first unless the first field is over 12 (day-first) or over 31 (yy/M/d); two-digit years 00-49 are 20xx (RFC 5322); named zones are fixed offsets (EDT is -4 all year) and an unknown 2-5 letter name means the zone is unknown (RFC 5322 4.3); a date-only value has no zone even if one was written.

Producer quirks accepted: HH:mmss, HH.mm.ss, one-digit seconds, trailing :cc after seconds, Z00:00, apostrophes in offsets (-06'00'), AM/PM after an ISO time, D: followed by ISO, a trailing (comment), a missing sign on a 0000 offset, and, in mail forms only, junk after a complete time and numeric offset. Inputs over 256 characters are rejected unread.

Storage (TikaDates.ParsedDate.toMetadataString()): explicit zone -> canonical UTC ...Z; no zone -> yyyy-MM-dd'T'HH:mm:ss; date-only -> yyyy-MM-dd. Reading back (TikaDates.ParsedDate.toInstant()) treats no zone as UTC and date-only as midday UTC.