Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: How do I validate a date?

by plaid (Chaplain)
on May 25, 2000 at 03:06 UTC ( #14688=note: print w/replies, xml ) Need Help??


in reply to How do I validate a date?

There are a couple ways to do this. The best that comes to mind is to grab a module for it (I prefer Date::Calc personally). You could then do something like
unless(check_date(param('year'), param('month'), param('day')) { # do something }
A non-modular way to accomplish this would be to create an array of month lengths, i.e.
my @month_lengths = (31, 28, 31, 30, ......);
which would require one additional check for leap-year.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://14688]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2022-05-19 03:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (71 votes). Check out past polls.

    Notices?