您如何在小于 < 的版本中从时间戳创建 DateTime5.3?
How do you create a DateTime from timestamp in versions less than < 5.3?
在 5.3 中会是:
$date = DateTime::createFromFormat('U', $timeStamp);
DateTime 构造函数需要一个字符串,但这对我不起作用
The DateTime constructor wants a string, but this didn't work for me
$date = new DateTime("@$timeStamp");
PHP 5 >= 5.3.0
PHP 5 >= 5.3.0
$date = new DateTime();
$date->setTimestamp($timeStamp);
为 setTimestamp
这篇关于从 PHP 中的时间戳创建 DateTime5.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!