PKPLocale::getTimeZone PHP Method

getTimeZone() static public method

Get the sites time zone.
static public getTimeZone ( ) : string
return string Time zone
    static function getTimeZone()
    {
        $timeZone = null;
        // Load the time zone from the configuration file
        if ($timeZoneConfig = Config::getVar('general', 'time_zone')) {
            $timeZoneDAO = DAORegistry::getDAO('TimeZoneDAO');
            $timeZoneList = $timeZoneDAO->getTimeZones();
            foreach ($timeZoneList as $timeZoneKey => $timeZoneName) {
                if (in_array($timeZoneConfig, array($timeZoneKey, $timeZoneName))) {
                    $timeZone = $timeZoneKey;
                    break;
                }
            }
        }
        // Fall back to the time zone set in php.ini
        if (empty($timeZone)) {
            $timeZone = ini_get('date.timezone');
        }
        // Fall back to UTC
        if (empty($timeZone)) {
            $timeZone = 'UTC';
        }
        return $timeZone;
    }