时间格式化
程序员文章站
2022-03-24 23:44:29
...
时间格式化
//格式化时间 function format_date($beforetime) { $time= time() - $beforetime; $today=strtotime(date("M-d-y",mktime(0,0,0,date("m"),date("d"),date("Y")))); if($time =60 && $time$today){ $return="今天 ".date("H:i",$beforetime); }elseif($beforetime($today-86400)){ $return="昨天 ".date("H:i",$beforetime); }else{ $return=date("Y-m-d H:i",$beforetime); } } return $return; }