bcostacurta has asked for the wisdom of the Perl Monks concerning the following question:
I have a problem using the package DateTime::Format::Strptime.
Using the two following patterns :
pattern => '%B %d %Y %H:%M:%S' eg. 'Dec 16 2014 21:03:46'
pattern => '%B %d %H:%M:%S' eg. 'Sep 16 21:00:00'
The first pattern works, but not the second (which does not include the year neither in pattern neither in string).
Where could be the problem ?
Output is :#!/usr/bin/perl use DateTime::Format::Strptime; my $t = 'Dec 16 2014 21:03:46'; my $Strp = DateTime::Format::Strptime::->new( pattern => '%B %d %Y %H:%M:%S', locale => 'en_US', ); # my $dt = $Strp->parse_datetime($t); print "'$dt'\n"; my $t2 = 'Sep 16 21:00:00'; my $Strp2 = DateTime::Format::Strptime::->new( pattern => '%B %d %H:%M:%S', locale => 'eu_US', ); # my $dt2 = $Strp2->parse_datetime($t2); print "'$dt2'\n";
'2014-12-16T21:03:46' ''
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: about DateTime::Format::Strptime
by toolic (Bishop) on Dec 16, 2014 at 21:09 UTC | |
|
Re: about DateTime::Format::Strptime
by MidLifeXis (Monsignor) on Dec 16, 2014 at 21:10 UTC | |
by bcostacurta (Initiate) on Dec 17, 2014 at 19:55 UTC |