0 follower

Final Class Yiisoft\Db\Mysql\ServerInfo

InheritanceYiisoft\Db\Mysql\ServerInfo » Yiisoft\Db\Driver\Pdo\PdoServerInfo

Public Methods

Hide inherited methods

Method Description Defined By
getTimezone() Yiisoft\Db\Mysql\ServerInfo

Method Details

Hide inherited methods

getTimezone() public method

public getTimezone( boolean $refresh false ): string
$refresh boolean

                public function getTimezone(bool $refresh = false): string
{
    /** @psalm-suppress TypeDoesNotContainType */
    if (!isset($this->timezone) || $refresh) {
        /** @var string */
        $this->timezone = $this->db->createCommand(
            "SELECT LPAD(TIME_FORMAT(TIMEDIFF(NOW(), UTC_TIMESTAMP), '%H:%i'), 6, '+')",
        )->queryScalar();
    }
    return $this->timezone;
}