它给出了“MessageA非常好的数值遇到的”
$date="2014-06-06 12:00:00";
date_diff(date('Y-m-d H:i:s',$date),date('Y-m-d H:i:s'));
答案 0 :(得分:1)
尝试获得差异
$date1="2014-06-06 12:00:00";
$date2 = date('Y-m-d H:i:s');
echo $diff = abs(strtotime($date2) - strtotime($date1));
或使用日期时间
$datetime1 = new DateTime("2014-06-06 12:00:00");
$datetime2 = new DateTime("2014-06-06 12:00:00");
$difference = $datetime1->diff($datetime2);
echo 'Difference: '.$difference->y.' years, '
.$difference->m.' months, '
.$difference->d.' days';
print_r($difference);