我从API获得以下日期格式:
1468102548
我正在尝试将此日期转换为普通的人类可读格式,但是我无法使其正常工作。
到目前为止,这是我尝试过的方法:
$creation_date = "1468102548";
$input1 = $creation_date / 1000;
$newDate_creation_date = date("Y-m-d", $input1); // Output: 1970-01-17 (It's not right)
该时间戳记不是以毫秒为单位,因此将其除以1000会歪曲您的日期。
$creation_date = new DateTime('@1468102548');
echo $creation_date->format('Y-m-d'); // Outputs 2016-07-09
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句