in reply to calculating 24 hours ago with localtime

Based on the code, it appears that the date is written as human readable. If you used time in seconds (enteries will look like 1134035260 in the db), you can take something like:
my $maxhour = time() - (24*60*60); my $data = qq(DELETE FROM day_time WHERE time <= "$maxhour");
This difference is, is you would query the db for a long number verses a string, which may be the reason its currently failing.

Printing the time in human readable format could be done with my $TOL = sprintf "%d d, %d h, %d m \& %d s\n",(gmtime $dbdata{day_time})[7,2,1,0]; print $TOL;. This assumes you use Time::Local;.