$startTime = date("Y-m-d H:i:s"); if(strpos($date,'分钟前') !== false){ $dtime=strstr($date,'分钟前',true); $mstr = $dtime>1?' minutes':' minute'; $tstr= '-'.$dtime.$mstr; $date = date('Y-m-d H:i:s',strtotime($tstr,strtotime($startTime))); }else if(strpos($date,'小时前') !== false){ $dtime=strstr($date,'小时前',true); $hstr = $dtime>1?' hours':' hour'; $tstr= '-'.$dtime.$hstr; $date = date('Y-m-d H:i:s',strtotime($tstr,strtotime($startTime))); }
标签:dtime,分钟,strtotime,日期,startTime,date,php,转为,tstr From: https://www.cnblogs.com/meetrice/p/17187397.html