- date: documentation ( source)
- strtotime: documentation ( source)
<?php
function humanizeDayOfDate($date)
{
if( date('d.m.Y', strtotime($date)) == date('d.m.Y') ) {
return 'Today';
}
if( date('d.m.Y', strtotime($date)) == date('d.m.Y', strtotime('-1 day')) ) {
return 'Yesterday';
}
}
echo humanizeDayOfDate('2013-03-05');