- time: documentation ( source)
- date: documentation ( source)
- strtotime: documentation ( source)
<?php
echo $phpdate = strtotime('-1 day');
echo PHP_EOL;
echo $mysqldate = date('Y-m-d H:i:s', $phpdate);
echo PHP_EOL;
$last_access = $phpdate;
$now = time();
echo $last_midnight = $now - ($now % (24*60*60));
if ($last_access >= $last_midnight)
{
print "Today";
}
elseif ($last_access >= ($last_midnight-(24*60*60)))
{
print "Yesterday";
}
?>