http://www.perlmonks.org?node_id=999706


in reply to Re: How to check if a date exists ?
in thread How to check if a date exists ?

Hi,

First of all thank you for your answer, secondly, you're saying that this module is in the core since 5.10, but I'm using Perl 5.8.8, so I still can use it but I have to install it first right ?

And finally, could you please "validate" my code ? :

my $s = '20121018'; my $date; eval { $date = Time::Piece->strptime("$s"); }; if ( $@ ) { die qq{Error : the date doesn't exist or is not like YYYYMMDD\ +n} } else {print qq{date OK\n}} ;

Regards