我写了以下代码:
$timestamp = "1483625713000";
$date = date('d-m-Y', $timestamp);
$time = date('Gi.s', $timestamp);
但输出未达到预期效果: 我的输出:
echo $date // 23-03-48984
echo $time // 2136.40
答案 0 :(得分:1)
看起来您在该时间戳中有毫秒的时间。试试这个:
$timestamp = 1483625713000 / 1000;
$date = date('d-m-Y', $timestamp);
$time = date('Gi.s', $timestamp);
var_dump($date);
var_dump($time);
输出
string(10) "05-01-2017"
string(7) "1415.13"