use POSIX; # this module defines the function mktime $last=$FORM{'userTime'}; # this is the timestamp of the user's last login $now=time; # the present ($sec,$min,$hr,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($now-$FORM{'timeControl'}); # a day ago ($mon2,$mday2,$wday2,$year2,$hr2,$min2,$sec2)=($last=~m|^(\d+)/(\d+)/(\d+)/(\d+)/(\d+):(\d+):(\d+)|) or die "Wrong timestamp: $last\n"; # extract values from the timestamp, with a bit of checking $year = $year + 1900; $last_time=POSIX::mktime($sec2,$min2,$hr2,$mday2,$mon2,$year2); # trans form the timestamp into a unix-time (seconds since the epoch) unless (defined $last_time) {die "Wrong timestamp2: $last\n$year, $year2"} # mktime will return undef if the date is not valid