我查询了一个API,得到了这个响应
$response = [635355360000000000.0, 6.400000, 6.510000, 6.400000, 6.470000, 1586684.00];
该数组的第一个元素应该是日期,当我环顾四周如何转换时,最接近我的答案的代码是:
$dateLargeInt= $response[0];
$secsAfterADEpoch = $dateLargeInt / (10000000);
$ADToUnixConvertor=((1970-1601) * 365.242190) * 86400;
// unix epoch - AD epoch * number of tropical days * seconds in a day
$unixTsLastLogon=intval($secsAfterADEpoch-$ADToUnixConvertor);
// unix Timestamp version of AD timestamp
$lastlogon=date("d-m-Y", $unixTsLastLogon); // formatted date
echo $lastlogon;
这是我得到12-05-3614的结果
我也尝试过:
$dateLargeInt= $response[0];
echo date('Y-d-m',$response[0]);
这是结果20133611831-11-12
答案 0 :(得分:1)
由于文档中指定了日期,因此您可以阅读the definition。
This article也可以帮助您理解。
然后尝试:
$seconds = ($response[0] - 621355968000000000) / 10000000;
echo date("Y-m-d H:i:s", $seconds);