initself has asked for the wisdom of the Perl Monks concerning the following question:
Venerable Monks,
I am using DateTime::Format::Strptime with a date in the format '%d%b%g' (ie. 05Jul08);According to DateTime, %b should be the "abbreviated month name". I assume that with the 'en_US' locale set, that would mean 'Jul' in my case. However DateTime::Format::Strptime seems to be looking for 'July', or something with four characters: This is the error I get using the 'croak' parameter.$date = "05Jul08"; my $strp = DateTime::Format::Strptime->new( pattern => '%d%b%g', locale => 'en_US', on_error => 'croak', ); my $dt = $strp->parse_datetime($date);
There is no use providing a month name (Jul0) without providing a year +. at parse_raw_reports.pl line 63
Am I assuming that DateTime::Format::Strptime does something that it doesn't do? Can someone see what I might be doing wrong?
Thanks,
mb
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DateTime::Format::Strptime - strftime formats not working?
by pc88mxer (Vicar) on Jul 10, 2008 at 17:27 UTC | |
by initself (Monk) on Jul 10, 2008 at 22:57 UTC | |
|
Re: DateTime::Format::Strptime - strftime formats not working?
by moritz (Cardinal) on Jul 10, 2008 at 17:23 UTC | |
by jethro (Monsignor) on Jul 10, 2008 at 17:30 UTC | |
by initself (Monk) on Jul 10, 2008 at 22:48 UTC |