Subject: | DateTime::Format::Strptime not parsing some dates with the pattern %Y-%m-%d %H:%M:%S |
Date: | Thu, 30 Apr 2015 11:55:55 +0000 |
To: | "bug-DateTime-Format-Strptime [...] rt.cpan.org" <bug-DateTime-Format-Strptime [...] rt.cpan.org> |
From: | Robert Marlton <robertm [...] broadbean.com> |
Hi,
If I run:-
use DateTime::Format::Strptime;
use Data::Dumper;
my $date_parser = DateTime::Format::Strptime->new(
pattern => '%Y-%m-%d %H:%M:%S',
locale => 'en_UK',
time_zone => 'Europe/London',
);
my $datetime = '2014-03-30 01:00:00';
print DateTime::Format::Strptime->VERSION;
print "\n" . $datetime . "\n";
my $application_time = $date_parser->parse_datetime($datetime);
print Dumper($application_time);
I get the following output:-
1.56
2014-03-30 01:00:00
$VAR1 = undef;
For some reason it doesn't treat 2014-03-30 01:00:00 as a valid date/time. The only way I could find to get this date to parse was either by changing the date (I changed it to be the 31st March) or by removing the time element completely (and adjusting the pattern accordingly).
Regards,
Robert Marlton