date_format
The date_format command is used to format dates in various ways. The command requires that dates in the CSV input are in ISO YYYY-MM-DD format. You can convert dates to this format using the date_iso command.
See also: date_iso
Flag |
Req'd? |
Description |
-f fields |
Yes |
A comma-separated list of fields to attempt to format. If a specified field does not contain a valid date in ISO YYYY-MM-DD format, it is not converted. |
-fmt format |
Yes |
A format specification. The formatters currently available are as follows; |
The following example takes the file birthdays.csv, converts it to ISO format and then pipes the resulting output into another CSVfix command which outputs the birthday field in the form "Mon 3 Jun 2009" (please note the pipe symbol in the command line):
csvfix date_iso -f 2 -m 'd/m/y' data/birthdays.csv |
csvfix date_format -f 2 -fmt 'w d mmm yyyy'
which produces:
"Peter","Sun 20 Jan 2000
"Jane","Tue 12 Jan 1970"
"Bill","Sat 14 Jan 1971"
"Anna","Sat 27 Jan 1976"
Created with the Personal Edition of HelpNDoc: Free Qt Help documentation generator