use Date::Calc qw(check_date);
if (check_date($year, $month, $day))
{ print "Valid date\n"; }
-----Original Message-----
From: David Mintz [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 16, 2001 8:56 AM
To: [EMAIL PROTECTED]
Subject: RE: easiest way to check a date for validity
On Wed, 15 Aug 2001, Wagner-David wrote:
>
> Should be able using timelocal and localtime to validate and not
> have much overhead.
>
I don't get it:
use Time::Local;
$time = timelocal(0,0,0,31,1,101); # February 31, 2001 (!)
print scalar localtime($time); # says March 3, 2001
timelocal fixes the date, I want something that returns false for an
invalid date.
the other fixes suggested are greatly appreciated. I've done my share of
javascript and the thing that gets me about it is that if you're
serious, you still have to validate server-side in case a browser has
it disabled or doesn't support it. so you end up doing the work twice,
doing great violence to the Laziness principle.
David Mintz
Spanish Interpreter
US District Court, Southern District of New York
Web Design & Hosting http://www.dmintzweb.com/
Personal http://www.panix.com/~dmintz/
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl
RE: easiest way to check a date for validity
Jones Robert Contr 81 CS/SCK Thu, 16 Aug 2001 07:09:46 -0700
- RE: easiest way to check a date for validity David Mintz
- RE: easiest way to check a date for vali... Rob Dixon
- RE: easiest way to check a date for ... David Mintz
- Jones Robert Contr 81 CS/SCK
