- time: documentation ( source)
- date: documentation ( source)
- strtotime: documentation ( source)
<?php
echo $phpdate = strtotime('-1 day');
echo PHP_EOL;
$mysqldate = date('Y-m-d H:i:s', $phpdate);
function get_day_name($timestamp) {
$date = date('d/m/Y', $timestamp);
if($date == date('d/m/Y')) {
$day_name = 'Today';
} else if($date == date('d/m/Y',time() - (24 * 60 * 60))) {
$day_name = 'Yesterday';
}
return $day_name;
}
print date('G:i:s', $phpdate).' '.get_day_name($phpdate);
?>