Skip to content

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

FlagDescription
--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_&lt;key&gt;').
--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 / -eInput date is in epoch seconds.
--output-epoch / -EOutput 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 -E

Parse 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

See Also

Released under the MIT License.