NAME

App::csvtool::Timetools - commands for csvtool that handle timestamps

DESCRIPTION

This module provides commands for the csvtool wrapper script that deal with timestamp data in fields.

Timestamp Parsing

When parsing a timestamp in order to generate a UNIX epoch time, only the 6 basic fields (sec, min, hour, mday, mon, year) are used. Not all fields are required.

Any missing fields less significant than the ones provided by the format are filled in with default zeroes (or 1 for the mday field). For example, a format that specifies only the mday, mon and year fields will take a default time of 00:00:00 within each day.

COMMON OPTIONS

Commands in this module recognise the following common options

--timefmt

Format string to use for formatting or parsing timestamps. Defaults to ISO 8601 standard, i.e.

%Y-%m-%dT%H:%M:%S

--utc, -U

Use UTC instead of local time.

COMMANDS

strftime

$ csvtool strftime -fFIELD --timefmt=... FILE

Formats a timestamp by using a strftime format, replacing the field with the same time formatted as a string.

--field, -f

The field index to format the timestamp into (defaults to 1).

strptime

$ csvtool strptime -fFIELD --timefmt=... FILE

Parses a timestamp by using a strptime format, replacing the field with the same time expressed as a UNIX epoch integer.

--field, -f

The field index to parse the timestamp from (defaults to 1).

tsort

$ csvtool tsort -fFIELD --timefmt=... FILE

A variant of the basic sort command that parses a timestamp from a field and sorts rows in chronological order based on those timestamps.

--field, -f

The field index to parse the sorting timestamp from (defaults to 1).

--reverse, -r

Reverses the order of sorting.

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>