#!/usr/bin/perl -- use strict; use warnings; use DateTime::Format::Strptime; # YYYYMMDDHHMMSS format(ex:20090527051000). Is # 2009 05 27 05 10 00 my $strp = DateTime::Format::Strptime->new( pattern => '%Y%m%d%H%M%S', on_error => 'croak' ); my $date = $strp->parse_datetime("20090527051000"); print "$date\n"; # this suprisingly works, must be a bug $date = $strp->parse_datetime("200905270510XX"); print "$date\n"; # this fails as expected, $date = $strp->parse_datetime("20090527051099"); print "$date\n"; __END__ 2009-05-27T05:10:00 2009-05-27T05:01:00 99 is too large to be a second. at - line 22