I m using following code.
static::$timezone = new \DateTimeZone(date_default_timezone_get() ?: 'UTC');
'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), static::$timezone)->setTimezone(static::$timezone),
but I m getting error.
Fatal error: Call to a member function setTimezone() on a non-object
So what is wrong in the code
->setTimezone
is not needed, just make surestatic::$timezone
is indeed aDateTimezone
object – Kevin