0

我得到了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)\/"
4

1 回答 1

2

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

应该:

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

$finishO是一个无效的时间戳,导致 date 显示为 0,默认为 unix epoch。

于 2012-11-29T18:33:16.047 回答