Returns curent fate time in RFC1123 format, using UTC time zone

@return  string
2136
private function getRFC1123DateString() {
        $date = new \DateTime(null, new \DateTimeZone("UTC"));
        return str_replace("+0000", "GMT", $date->format(\DateTime::RFC1123));
    }
909314
private function getTimezonesHavingNewDaySinceLastRun()
    {
        $timestamp = $this->lastSuccessRunTimestamp;
        $uniqueTimezones = APISitesManager::getInstance()->getUniqueSiteTimezones();
        $timezoneToProcess = array();
        foreach ($uniqueTimezones as &$timezone) {
            $processedDateInTz = Date::factory((int)$timestamp, $timezone);
            $currentDateInTz = Date::factory('now', $timezone);

            if ($processedDateInTz->toString() != $currentDateInTz->toString()) {
                $timezoneToProcess[] = $timezone;
            }
        }
        return $timezoneToProcess;
    }
908228
private function client_timezone()
    {
        // @TODO: remove this legacy timezone handling in the future
        $props = $this->fix_legacy_props(array('timezone' => $_SESSION['timezone']));

        if (!empty($props['timezone'])) {
            try {
                $tz = new DateTimeZone($props['timezone']);
                return $tz->getName();
            }
            catch (Exception $e) { /* gracefully ignore */ }
        }

        // fallback to server's timezone
        return date_default_timezone_get();
    }
933747
public static function getTimestamp() {
        $time = microtime(true);
        $microseconds = sprintf('%06d', ($time - floor($time)) * 1000000);
        $millseconds = round($microseconds, -3)/1000;
        $millsecondsStr = str_pad($millseconds, 3, '0', STR_PAD_LEFT);
        $date = (new \DateTime(null, new \DateTimeZone("UTC")))->format('c');

        $position = strrpos($date, '+');
        $date = substr($date,0,$position).'.'.$millsecondsStr.substr($date,$position);

        return $date;
    }
1059327
public function getTimestamp(): int
    {
        $supportedClasses = implode(
            ', ',
            [
                '\MongoTimestamp',
                '\MongoDate',
                '\MongoDB\BSON\Timestamp',
                '\MongoDB\BSON\UTCDateTime',
                '\DateTimeInterface',
            ]
        );

        if (!$this->t || !is_object($this->t)) {
            throw new \DomainException(
                'The timestamp to normalise must be one of ' . $supportedClasses . ' but it is not an object'
            );
        }

        switch (get_class($this->t)) {
            case 'MongoTimestamp':
                return (int) $this->t->__toString();

            case 'MongoDate':
                return $this->t->sec;

            case 'MongoDB\BSON\Timestamp':
                return $this->t->getTimestamp();

            case 'MongoDB\BSON\UTCDateTime':
                return (int) $this->t->toDateTime()->format('U');
        }

        if ($this->t instanceof \DateTimeInterface) {
            return $this->t->getTimestamp();
        }

        throw new \DomainException(
            'The normalised timestamp must be one of ' . $supportedClasses
        );
    }
363360
public function getTimezoneOptions()
    {
        $timezoneIdentifiers = DateTimeZone::listIdentifiers();
        $utcTime = new DateTime('now', new DateTimeZone('UTC'));

        $tempTimezones = [];
        foreach ($timezoneIdentifiers as $timezoneIdentifier) {
            $currentTimezone = new DateTimeZone($timezoneIdentifier);

            $tempTimezones[] = [
                'offset' => (int) $currentTimezone->getOffset($utcTime),
                'identifier' => $timezoneIdentifier
            ];
        }

        // Sort the array by offset, identifier ascending
        usort($tempTimezones, function ($a, $b) {
            return $a['offset'] === $b['offset']
                ? strcmp($a['identifier'], $b['identifier'])
                : $a['offset'] - $b['offset'];
        });

        $timezoneList = [];
        foreach ($tempTimezones as $tz) {
            $sign = $tz['offset'] > 0 ? '+' : '-';
            $offset = gmdate('H:i', abs($tz['offset']));
            $timezoneList[$tz['identifier']] = '(UTC ' . $sign . $offset . ') ' . $tz['identifier'];
        }

        return $timezoneList;
    }
1298748
public function getTimezone()
    {
        if (null === $this->timezone) {
            $this->timezone = new DateTimeZone(date_default_timezone_get());
        }

        return $this->timezone;
    }
941040
private function getCronTimestamp()
    {
        /* @var $version string e.g. "2.1.7" */
        $version = $this->productMetadata->getVersion();
        if (version_compare($version, '2.2.0') >= 0) {
            return $this->dateTime->gmtTimestamp();
        }
        return $this->timezone->scopeTimeStamp();
    }
910823
public function getPHPTimePattern()
    {
        $isoFormat = Calendar::getTimeFormat('short');
        $result = Calendar::tryConvertIsoToPhpFormat($isoFormat);
        if ($result === null) {
            $result = t(/*i18n: Short time format: see http://www.php.net/manual/en/function.date.php */ 'g.i A');
        }

        return $result;
    }
614894
public function asUTCTime(): Primitive\UTCTime
    {
        if (!$this->_element instanceof Primitive\UTCTime) {
            throw new \UnexpectedValueException(
                $this->_generateExceptionMessage(Element::TYPE_UTC_TIME));
        }
        return $this->_element;
    }
1151739
public function user_date()
    {
        // get user's timezone
        try {
            $tz   = new DateTimeZone($this->config->get('timezone'));
            $date = new DateTime('now', $tz);
        }
        catch (Exception $e) {
            $date = new DateTime();
        }

        return $date->format('r');
    }
962891
public static function get_server_timezone() {
        global $CFG;

        if (!isset($CFG->timezone) or $CFG->timezone == 99 or $CFG->timezone === '') {
            return self::get_default_php_timezone();
        }

        return self::normalise_timezone($CFG->timezone);
    }
840156
public function getAuthUserDateTimezone()
    {
        $user = $this->getAuthUser();
        if ($user && !empty($user->timezone)) {
            return $user->timezone;
        } else {
            return app_timezone();
        }
    }
871339
public function GetMicrotime () {
		if ($this->microtime === NULL) $this->microtime = $this->globalServer['REQUEST_TIME_FLOAT'];
		return $this->microtime;
	}
736388
public function toDateTime()
    {
        $datetime = new \DateTime();
        $datetime->setTimestamp($this->sec);

        $microSeconds = $this->truncateMicroSeconds($this->usec);
        if ($microSeconds > 0) {
            $datetime = \DateTime::createFromFormat('Y-m-d H:i:s.u', $datetime->format('Y-m-d H:i:s') . '.' . str_pad($microSeconds, 6, '0', STR_PAD_LEFT));
        }

        $datetime->setTimezone(new \DateTimeZone("UTC"));

        return $datetime;
    }
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);
    }
1302830
public static function timeZoneOffset() : PatternParser
    {
        static $parser;

        if ($parser) {
            return $parser;
        }

        return $parser = (new PatternParserBuilder())
            ->startGroup()
            ->appendCapturePattern('[Zz]', TimeZoneOffsetSign::NAME)
            ->appendOr()
            ->startGroup()
            ->appendCapturePattern('[\-\+]', TimeZoneOffsetSign::NAME)
            ->appendCapturePattern(TimeZoneOffsetHour::PATTERN, TimeZoneOffsetHour::NAME)
            ->appendLiteral(':')
            ->appendCapturePattern(TimeZoneOffsetMinute::PATTERN, TimeZoneOffsetMinute::NAME)
            ->startOptional()
            ->appendLiteral(':')
            ->appendCapturePattern(TimeZoneOffsetSecond::PATTERN, TimeZoneOffsetSecond::NAME)
            ->endOptional()
            ->endGroup()
            ->endGroup()
            ->toParser();
    }