in reply to Date::Manip and date
First, a single array element should be written like this:
$begindate_fields[2];
and not like this:
@begindate_fields[2];
The latter is an array slice. The warnings pragma would have told you this. You should always start your script with:
use strict; use warnings;
This will save you a lot of time and trouble in the long run.
Second, Date::Manip::ParseDate interprets your dates as MM/DD/YYYY, not DD/MM/YYYY. So 1988-12-13 becomes the twelfth day of the thirteenth month of 1988 — which does not exist. You need to swap the first and second array indices:
my $normalized_begindate = $begindate_fields[1] . "/" . # Month $begindate_fields[2] . "/" . # Day $begindate_fields[0]; # Year my $normalized_enddate = $enddate_fields [1] . "/" . # Month $enddate_fields [2] . "/" . # Day $enddate_fields [0]; # Year
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Date::Manip and date
by SBECK (Chaplain) on Jul 09, 2015 at 17:45 UTC | |
|
Re^2: Date::Manip and date
by Anonymous Monk on Jul 09, 2015 at 10:41 UTC |