Ok I figured out that I was using %G (The year corresponding to the ISO week
number) instead of %Y.
But I still thinks this is weird that the format instance is not able to
parse what it just has formatted.

Thanks

On Wed, May 27, 2009 at 1:10 PM, Karl Forner <karl.for...@gmail.com> wrote:

> Hello,
>
> Consider this code :
>
>
>     my $formatter
>         = DateTime::Format::Strptime->new( pattern => "%d-%b-%G", on_error
> => 'croak' );
>     my $date = DateTime->now();
>     my $formatted = $formatter->format_datetime($date);
>     warn "formatted=$formatted"; # output e.g. 27-May-2009
>     my $parsed_date = $formatter->parse_datetime($formatted);
>
>
> => got
> There is no use providing a month name (May) without providing a year. at
> bug_datetime.pl line 8
>
> So the formatting is ok, but the parsing fails, with an incorrect message.
>
> It seems to be a bug, but maybe I missed something. It's problematic
> because I reallny need to parse these types of dates (27-May-2009).
>
>
>
> P.S
> $DateTime::Format::Strptime::VERSION = '1.0901';
>

Reply via email to