Database Reference
In-Depth Information
If you feed isoize_date.pl an input file that looks like this:
Sybil 04-13-70
Nancy 09-30-69
Ralph 11-02-73
Lothair 07-04-63
Henry 02-14-65
Aaron 09-17-68
Joanna 08-20-52
Stephen 05-01-60
It produces the following output:
Sybil 1970-04-13
Nancy 2069-09-30
Ralph 1973-11-02
Lothair 2063-07-04
Henry 2065-02-14
Aaron 2068-09-17
Joanna 2052-08-20
Stephen 2060-05-01
isoize_date.pl serves a specific purpose: it converts only from US to ISO format. It does
not perform validity checking on date subparts or permit the transition point for adding
the century to be specified. A more general tool would be more useful. The next script,
cvt_date.pl , extends the capabilities of isoize_date.pl ; it recognizes input dates in ISO,
US, or British formats and converts any of them to any other. It also can convert two-
digit years to four digits, enable you to specify the conversion transition point, and warn
about bad dates. As such, it can be used to preprocess input for loading into MySQL or
postprocess data exported from MySQL for use by other programs.
cvt_date.pl understands the following options:
--iformat= format , --oformat= format , --format= format
Set the date format for input, output, or both. The default format value is iso ;
cvt_date.pl also recognizes any string beginning with us or br as indicating US or
British date format.
--add-century
Convert two-digit years to four digits.
--columns= column_list
Convert dates only in the named columns. By default, cvt_date.pl looks for dates in
all columns. If this option is given, column_list should be a list of one or more
column positions or ranges separated by commas. (Ranges can be given as m-n to
specify columns m through n .) Positions begin at 1.
--transition= n
Specify the transition point for two-digit to four-digit year conversions. The default
transition point is 70. This option turns on --add-century .
Search WWH ::




Custom Search