in reply to time validation
#!/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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: time validation
by wol (Hermit) on May 19, 2009 at 10:53 UTC | |
by Anonymous Monk on May 19, 2009 at 11:35 UTC | |
by wol (Hermit) on May 19, 2009 at 13:33 UTC | |
|
Re^2: time validation
by Anonymous Monk on May 19, 2009 at 10:20 UTC |