There are probably modules on CPAN that will do that, there are a gazillion
of Date modules.  However, one option is to just wrap the $RptDate statement
in an eval...

eval {
  $RptDate = UnixDate($strDate, "%m/%d/%y");
}

now $@ should be the error result.

-----Original Message-----
From: Ron Rohrssen
To: Perl Beginners
Sent: 8/29/2001 7:55 AM
Subject: Validate a date

I'm looking for some advice on better methods of validating a date from
a
text string.

Currently, I am using Date::Manip like this: $RptDate =
UnixDate($strDate,
"%m/%d/%y"). If this fails the value of $RptDate will be "". That's
okay.
But, this also has the undesirable effect of dumping this message when
empty
strings are evaluated: "ERROR:  Invalid arguments to ParseDateDelta."

Ron


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to