parsedate
Parse date/time strings from a field and output them in a normalized format.
Synopsis
bash
recs parsedate [options] [files...]Description
Parse date/time strings from a field and output them in a normalized format. Supports epoch seconds, ISO 8601, and custom strftime-style format strings for both input and output.
Options
| Flag | Description |
|---|---|
--key / -k <key> | Key field containing the date/time string to parse. (required) |
--output / -o <key> | Output key for the parsed date (defaults to 'parsed_<key>'). |
--format / -f <format> | Input format for parsing (strftime-style). Common directives: %Y (4-digit year), %m (month), %d (day), %H (hour 24h), %M (minute), %S (second), %b (abbreviated month name), %p (AM/PM). |
--output-format / -F <format> | Output format (strftime-style). Defaults to ISO 8601 if not specified. |
--epoch / -e | Input date is in epoch seconds. |
--output-epoch / -E | Output as epoch seconds instead of a formatted string. |
--timezone / -z <timezone> | Timezone for output formatting (IANA name like 'America/New_York'). |
Examples
Parse dates and output as epoch seconds
bash
recs parsedate -k date -EParse a custom date format and reformat it
bash
recs parsedate -k timestamp -f '%d/%b/%Y:%H:%M:%S' -F '%Y-%m-%d %H:%M:%S'Convert epoch seconds to ISO 8601
bash
recs parsedate -k time -e -o iso_time