DateTimeZone::__construct():
starsnet opened this issue · 2 comments
Hi, all
I updated phpproject.
And now i have error:
500 Internal Server Error
DateTimeZone::__construct(): Unknown or bad timezone (Moscow) [.../public_html/projects/app/helper/view.php:308]
what need to do?)
Can this code return timezone in format Zone/City ?
Example, Europe/Moscow.
In fact, this code returns only the city(Moscow, for me). Without zone (Europe, for me).
public function timeoffset()
{
$f3 = \Base::instance();
if ($f3->exists("site.timeoffset")) {
return $f3->get("site.timeoffset");
} else {
$tz = $f3->get("site.timezone");
$dtzLocal = new \DateTimeZone($tz);
$dtLocal = new \DateTime("now", $dtzLocal);
$offset = $dtzLocal->getOffset($dtLocal);
$f3->set("site.timeoffset", $offset);
}
return $offset;
the question is closed.
Solution: it is necessary in the database (section config) to change the value of the City, to the Zone / City.
I upgraded from version 1.3.1 to 1.7.6.
Apparently, the structure and values in the database have changed in different versions.