in reply to Re: time validation
in thread time validation

Those functions take separate parameters for year, month, day, etc. You'd need some glue code to parse the string of digits into those parts. Eg:
if ($stringToTest =~ m/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/ & +& check_date($1, $2, $3) && check_time($4, $5, $6) ) { print "It's OK\n"; }
I suspect there's a way to simplify that regular expression - too much repetition!

--
use JAPH;
print JAPH::asString();

Replies are listed 'Best First'.
Re^3: time validation
by AnomalousMonk (Archbishop) on May 19, 2009 at 15:49 UTC
    >perl -wMstrict -le "my $s = '20090527051000'; my @matches = $s =~ m{ \A \d{4} | \d{2} }xmsg; print qq{@matches}; " 2009 05 27 05 10 00
      even if we give $s = '20090230051000'; o/p is 2009 02 30 05 10 00 I am looking for validation of dates. As you can see its displaying 30th feb, which is not right.