首页学无止境PHP
PHP 处理2038后的日期
发布时间:2018-08-29编辑:凌互动QQ群:339647710阅读() 收藏
将时间戳转为年月日
$d = new DateTime("@21474836490"); $d->setTimezone(new DateTimeZone("PRC")); echo $d->format("Y-m-d H:i:s");
将年月日转为时间戳
$d = new DateTime('2650-07-06 16:21:30'); echo ' '.$d->format('U');
运行时 可能会报
warning: It is not safe to rely on the system’s timezone settings
(最好的方法)在php.ini里加上找到date.timezone项,设置date.timezone = “Asia/Shanghai”,重启环境就ok了。
关键字词:
上一篇:微信登录接口
下一篇:日志-本周、上周、本月