1

I've been looking for a while, it used to work but it does'nt anymore and I can't find why. Does one of you have an idea?

$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);

I get this error: Fatal error: Call to a member function setTimeZone() on a non-object.

Thanks a lot for your help, I hope it's something dumb and that I was just lost...

4

1 回答 1

1

In DateTime::createFromFormat, it returns FALSE on failure, which leads to your error.

What is the value of $time ?

于 2013-05-10T03:06:28.047 回答