Get timezone

@return string Current timezone
163860
public function timezone()
	{
		$params = array(
			$this->database,
			$this->user,
			$this->password
		);

		return $this->getClient('common')->call('timezone_get', $params);
	}
241993
public static function now()
    {
        $date = new DateTime();
        if (self::$freeze) {
            $date->setTimestamp(self::$freezeDate->getTimestamp());
            $date->setTimezone(self::$freezeDate->getTimezone());
        }
        return new Clock($date);
    }
352604
protected static function getTime() {
		$mtime = microtime();
		$mtime = explode(" ",$mtime); 
		$mtime = $mtime[1] + $mtime[0]; 
		return $mtime;
	}
358506
public static function getTimeZones(): array
	{
		$timeZones = [];

		foreach(static::listIdentifiers() as $timeZone)
		{
			$timeZones[$timeZone] = str_replace('_', ' ', $timeZone);
		}

		return $timeZones;
	}
321071
private TimeZone getTimeZone() {

        // If no time zone is set, use the default
        String timeZone = getModel().getTimeZone();
        if (timeZone == null)
            return TimeZone.getDefault();

        // Otherwise parse and return time zone
        return TimeZone.getTimeZone(timeZone);

    }
887357
public function HourOffset() {
      static $GuestHourOffset;
      
      if ($this->UserID > 0) {
         return $this->User->HourOffset;
      } else {
         if (!isset($GuestHourOffset)) {
            $GuestTimeZone = C('Garden.GuestTimeZone');
            if ($GuestTimeZone) {
               try {
                  $TimeZone = new DateTimeZone($GuestTimeZone);
                  $Offset = $TimeZone->getOffset(new DateTime('now', new DateTimeZone('UTC')));
                  $GuestHourOffset = floor($Offset / 3600);
               } catch (Exception $Ex) {
                  $GuestHourOffset = 0;
                  LogException($Ex);
               }
            }
         }
         
         return $GuestHourOffset;
      }
   }
840156
public function getAuthUserDateTimezone()
    {
        $user = $this->getAuthUser();
        if ($user && !empty($user->timezone)) {
            return $user->timezone;
        } else {
            return app_timezone();
        }
    }
940290
private function getNow()
    {
        $timezone = new DateTimeZone(date_default_timezone_get() ?: 'UTC');

        return DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)))->setTimezone($timezone);
    }
696189
private function getTimestamp()
    {
        $zone = date('Z');
        $sign = ($zone < 0) ? '-' : '+';
        $zone = abs($zone);
        $zone = (int)($zone / 3600) * 100 + ($zone % 3600) / 60;
        return sprintf("%s %s%04d", date('D, j M Y H:i:s'), $sign, $zone);
    }
850517
public static function timezones()
    {
        $timezones = \DateTimeZone::listIdentifiers(\DateTimeZone::ALL);
        $offsets = [];
        $testDate = new \DateTime();

        foreach ($timezones as $zone) {
            $tz = new \DateTimeZone($zone);
            $offsets[$zone] = $tz->getOffset($testDate);
        }

        asort($offsets);

        $timezone_list = [];
        foreach ($offsets as $timezone => $offset) {
            $offset_prefix = $offset < 0 ? '-' : '+';
            $offset_formatted = gmdate('H:i', abs($offset));

            $pretty_offset = "UTC${offset_prefix}${offset_formatted}";

            $timezone_list[$timezone] = "(${pretty_offset}) ".str_replace('_', ' ', $timezone);
        }

        return $timezone_list;
    }
613452
public function getTimezonesList()
    {
        if (!SettingsServer::isTimezoneSupportEnabled()) {
            return array('UTC' => $this->getTimezonesListUTCOffsets());
        }

        $countries = StaticContainer::get('Piwik\Intl\Data\Provider\RegionDataProvider')->getCountryList();

        $return = array();
        $continents = array();
        foreach ($countries as $countryCode => $continentCode) {
            $countryCode = strtoupper($countryCode);
            $timezones = DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $countryCode);
            foreach ($timezones as $timezone) {
                if (!isset($continents[$continentCode])) {
                    $continents[$continentCode] = Piwik::translate('Intl_Continent_' . $continentCode);
                }
                $continent = $continents[$continentCode];

                $return[$continent][$timezone] = $this->getTimezoneName($timezone, $countryCode, count($timezones) > 1);
            }
        }

        // Sort by continent name and then by country name.
        ksort($return);
        foreach ($return as $continent => $countries) {
            asort($return[$continent]);
        }

        $return['UTC'] = $this->getTimezonesListUTCOffsets();
        return $return;
    }
879733
public static function timeZones()
    {
        $timeZones = [];

        $timezone_identifiers = DateTimeZone::listIdentifiers();
        sort($timezone_identifiers);

        $timeZones['UTC'] = Yii::t('podium/view', 'default (UTC)');

        foreach ($timezone_identifiers as $zone) {
            if ($zone != 'UTC') {
                $zoneName = $zone;
                $timeForZone = new DateTime(null, new DateTimeZone($zone));
                $offset = $timeForZone->getOffset();
                if (is_numeric($offset)) {
                    $zoneName .= ' (UTC';
                    if ($offset != 0) {
                        $offset = $offset / 60 / 60;
                        $offsetDisplay = floor($offset) . ':' . str_pad(60 * ($offset - floor($offset)), 2, '0', STR_PAD_LEFT);
                        $zoneName .= ' ' . ($offset < 0 ? '' : '+') . $offsetDisplay;
                    }
                    $zoneName .= ')';
                }
                $timeZones[$zone] = $zoneName;
            }
        }

        return $timeZones;
    }
522239
private function initDate2()
    {
        $now = \DateTime::createFromFormat('U', time());
        $now->setTimezone(new \DateTimeZone('UTC'));

        return $now->format('D, d M Y H:i:s') . ' GMT';
    }
654547
public static function now($tz = null)
    {
        return static::parse('now', TimeZone::create(($tz instanceof TimeZone ? (string)$tz : $tz)));
    }
661945
public static function getCurrentTimestamp()
    {
        $database = self::getDatabase();
        $sql = 'SELECT CURRENT_TIMESTAMP';
        return $database->query($sql)->fetch(\PDO::FETCH_NUM)[0];
    }
877934
protected function getDatetimeFormat()
    {
        if( $this->interval !== '* * * * *' )
        {
            $interval = $this->interval.' ';
        }
        else
        {
            $interval = ( $this->minute    ?? '*' ) . ' '.
                        ( $this->hour      ?? '*' ) . ' '.
                        ( $this->dayNumber ?? '*' ) . ' '.
                        ( $this->month     ?? '*' ) . ' '.
                        ( $this->day       ?? '*' ) . ' ';
        }

        $this->defaultIntervalVariables();

        return $interval;
    }
1257113
final public static function now()
    {
        if (self::$now === null) {
            try {
                self::$now = new \DateTimeImmutable('now', self::tzUtc());
            } catch (\Exception $e) {
                return null;
            }
        }

        return self::$now;
    }