PHP DateTimeZone error


PHP DateTimeZone error

我一直在寻找一段时间,它曾经工作,但它不再,我找不到原因。你们有什么主意吗?

$utc_time = DateTime::createFromFormat('Y-m-d H:i:s', $time, new DateTimeZone('US/Eastern'));
$utc_time->setTimeZone(new DateTimeZone("UTC")); // This line returns the error.
return $utc_time->format($dateformat);
我得到这个错误:Fatal error: Call to a member function setTimeZone() on a non-object .

非常感谢你的帮助,我希望这是愚蠢的东西,我只是迷路了…

在DateTime::createFromFormat中,如果失败则返回FALSE,从而导致错误。

$time的值是多少