Dates-LE
v2.5.0Extract dates and timestamps from logs, data files and code, with their format and position.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
extract_dates
Extract every date and timestamp from a document, with its notation, epoch value where resolvable, and 1-based line and column. Reads any text: JSON, YAML, CSV, XML, log and plaintext, JavaScript, TypeScript, HTML, TOML and Markdown are named formats, and anything else is scanned with the patterns they share. Recognises ISO 8601 in extended, basic, week and ordinal form, RFC formats, day-first and month-first numeric dates, dates with the month written out, and, when `kinds` includes "unix", Unix timestamps from seconds to nanoseconds.
| Parameter | Type | Description |
|---|---|---|
content * | string | The document text to scan. |
dateOrder | string | How to read a numeric date whose day and month could be either way round, such as 05/01/2024: "mdy" is 1 May, "dmy" is 5 January. A date that can only be read one way, such as 15/01/2024, is read that… |
dedupe | boolean | Collapse repeated dates to their first occurrence. |
filename | string | Filename used to infer the format when `format` is absent, e.g. "app.log". |
format | string | Document format. Common extensions and aliases are accepted. Optional: with neither this nor `filename` the document is scanned with the shared patterns. |
kinds | array | The kinds of date to return, by the name each carries as `format` in the answer. Defaults to every kind except "unix": a bare number such as 1705314645 is only read as a date when "unix" is listed. |
maxResults | integer | Cap on returned dates (default 500). meta.truncated reports whether any were dropped. |