I Fixed it with this:
########################################## TIME STAMP INFORMATION #######################################
$yesterday = time() - 86400; # 86400 is num seconds in 1 day
($sec, $min, $hours, $day_of_month, $month, $year , $wday, $yday, $isdst) = localtime($yesterday)...