PHP时间不正确

时间:2012-11-29 18:17:33

标签: php unix time

当我得到Sat 1 Dec 2 pm - 12pm时,我得到Sat 1 Dec, 2pm - 2:45pm的结果,我不确定为什么我的时间不正确。

$startO        = $openHome['Start'];
$finishO        = $openHome['End'];
$startConvert  = preg_replace('~\D~', '', $startO);
$start         = date('D j M g a',$startConvert / 1000);
$finishConvert = preg_replace('~\D~', '', $finishO);
$finish         = date('ga',$finishO / 1000);

$openHomeDetail = $start." - ". $finish;

$ startO& $ finishO:

"Start":"\/Date(1354323600000)\/","End":"\/Date(1354326300000)\/"

1 个答案:

答案 0 :(得分:2)

$finish = date('ga',$finishO / 1000);

应该是:

$finish = date('ga',$finishConvert / 1000);

$finishO是一个无效的时间戳,导致日期看到0,默认为unix纪元。