my $time; # Scalar to store the time in appropriate format for comparisons with the database time stamp. my ($year, $month, $day, $hour, $minute, $second); # for assembling time stamp. my @localtime = localtime; # Buffer to store time returned from localtime 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;