function getRangeDateString($timestamp) {
if ($timestamp) {
$currentTime=strtotime('today');
// Reset time to 00:00:00
$timestamp=strtotime(date('Y-m-d 00:00:00',$timestamp));
$days=round(($timestamp-$currentTime)/86400);
switch($days) {
case '0';
return 'Today';
break;
case '-1';
return 'Yesterday';
break;
case '-2';
return 'Day before yesterday';
break;
case '1';
return 'Tomorrow';
break;
case '2';
return 'Day after tomorrow';
break;
default:
if ($days > 0) {
return 'In '.$days.' days';
} else {
return ($days*-1).' days ago';
}
break;
}
}
}