F
friendly
I'm reading/re-writing data files with historical dates that go back
potentially to antiquity. e.g., one such has name, lifespan, birth
date/place,
death date/place as \t separated fields.
Galilei, Galileo 1564-1642 b: 15 Feb 1564, Pisa d: 8 Jan 1642,
Arcetri, Italy
Lalanne, Leon 1811-1892 b: Paris 3 Jul 1811 d:13 Mar 1892
I need to parse the dates and reformat them, e.g. in ISO 8601 --
'15 Feb 1564' => '1564-02-15'
I tried using Date
arse and Date:Format,
my ($name, $lived, $born, $died) = split(/\s?[\t]/);
if ($born) {
$born =~ s/^\s*b:\s+//;
($birthdate, $birthplace) = split(/,\s*/, $born, 2);
my $date = str2time($birthdate);
$birthdate = time2str("%Y-%m-%d", $date);
}
but, as I see now, this converts to seconds since the epoch, 1-
jan-1970,
so it can't work.
Are there other modules that deal with historical dates? Assume that
I don't need time values.
thanks
potentially to antiquity. e.g., one such has name, lifespan, birth
date/place,
death date/place as \t separated fields.
Galilei, Galileo 1564-1642 b: 15 Feb 1564, Pisa d: 8 Jan 1642,
Arcetri, Italy
Lalanne, Leon 1811-1892 b: Paris 3 Jul 1811 d:13 Mar 1892
I need to parse the dates and reformat them, e.g. in ISO 8601 --
'15 Feb 1564' => '1564-02-15'
I tried using Date
my ($name, $lived, $born, $died) = split(/\s?[\t]/);
if ($born) {
$born =~ s/^\s*b:\s+//;
($birthdate, $birthplace) = split(/,\s*/, $born, 2);
my $date = str2time($birthdate);
$birthdate = time2str("%Y-%m-%d", $date);
}
but, as I see now, this converts to seconds since the epoch, 1-
jan-1970,
so it can't work.
Are there other modules that deal with historical dates? Assume that
I don't need time values.
thanks