# $d, $m and $y have come from the web form. They will # be (for example) $d = 09, $m = 10, $y = 2002. # First we need to convert them to "timelocal-friendly" # values. $m--; $y -= 1900; # Then use eval to check date is valid eval "timelocal 0, 0, 0, $d, $m, $y"; # Warn on errors die "Invalid date\n" if $@;