标签:style c class blog code java
function group_date_format($time){ $time = strtotime($time); $currentDay = date(‘j‘,time()); $postDay = date(‘j‘,$time); if($currentDay == $postDay){ $hours = floor((time()-$time)/(60*60)); if($hours == 0){ $minutes = floor((time()-$time)/60); if($minutes<5){ return ‘刚刚‘; }else{ return $minutes.‘分钟前‘; } }else if($hours<5){ return $hours.‘小时前‘; }else{ return ‘今天‘.date(‘H:i‘,$time); } }else if($currentDay-$postDay == 1){ return ‘昨天‘.date(‘H:i‘,$time); }else if($currentDay-$postDay == 2){ return ‘前天‘.date(‘H:i‘,$time); }else{ return date(‘m-d‘,$time); } }
标签:style c class blog code java
原文地址:http://www.cnblogs.com/tianlai0910/p/3747165.html