my $time; # Scalar to store the time in appropriate format for compari +sons with the database time stamp. my ($year, $month, $day, $hour, $minute, $second); # for assembling ti +me stamp. my @localtime = localtime; # Buffer to store time returned from localt +ime function $year = 1900 + $localtime[5]; $month = $localtime[4] + 1; # because localtime starts counting months + at 0 $month = sprintf("%02d", $month); # force 2 digit format. $day = sprintf("%02d", $localtime[3]); $hour = sprintf("%02d", $localtime[2]); $minute = sprintf("%02d", $localtime[1]); $second = sprintf("%02d", $localtime[0]); $time = $year.$month.$day.$hour.$minute.$second;
And then compared the time string against what I was trying to validate. This node is where I was using the code snips above, and it was fairly specific to the format I was validating against, but I don't see any reason why you couldn't do a similar comparison between $userDate and $time if you've got your $time string formated according to your needs.
In reply to Re: Simple Date Validation
by starX
in thread Simple Date Validation
by Trihedralguy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |