导入数据并获取PHP DateTimeZone错误

时间:2016-01-02 09:54:32

标签: php datetime

目前我收到错误:

  

DateTimeZone :: __ construct():未知或错误的时区()

错误来自这段代码 - 任何想法?

protected function _resolveTimeZone($timeZone, $useDst)
{
    $time = new DateTime('now', new DateTimeZone($timezone));
    $offset = $time->getTimezone()->getOffset($time) / 60 / 60;
    $timeZone = $this->_importModel->resolveTimeZoneOffset($offset, $useDst);
    return $timeZone;
}

1 个答案:

答案 0 :(得分:1)

$timezone重命名为$timeZone。并查看$timeZone是哪个受支持的时区:http://php.net/manual/en/timezones.php