Return UTC now formatted as DB timestamp.
@return string 'YYYY-MM-DD HH:MM:SS
961480
public function getUtcNowForDb()
    {
        $dt = $this->getUtcNow();
        $result = $this->hlpFormat->dateTimeForDb($dt);
        return $result;
    }
1211416
private function _generateTimestamp()
    {
        $time = microtime(true);
        $micro = sprintf('%06d', ($time - floor($time)) * 1000000);
        $date = new DateTime(date('Y-m-d H:i:s.' . $micro, $time));
        return $date->format("Y-m-d H:i:s.u");
    }
1238774
final public static function nowSql()
    {
        try {
            $date = new \DateTimeImmutable(null, self::tzUtc());
            return $date->format('Y-m-d H:i:s');
        } catch (\Exception $e) {
            return null;
        }


    }
545676
def date_utc(self) -> datetime:
        """"""
        return datetime.utcfromtimestamp(self._node["date"] if "date" in self._node else self._node["taken_at_timestamp"])
170144
public function getTimestamp()
    {
        if (!isset($this->data['ts'])) {
            return null;
        }

        $time = new \DateTime();
        $time->setTimestamp($this->data['ts']);
        return $time;
    }
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);
    }
1028132
protected function getUTCTimezone()
    {
        if (\date_default_timezone_get() == 'UTC') {
            return 'UTC'; //already in UTC. workaround as zone must be non empty
        }
         
        $timezone = new \DateTimeZone(\date_default_timezone_get()); // Get default system timezone to create a new DateTimeZone object
        $offset = $timezone->getOffset(new \DateTime()); // Offset in seconds to UTC
        $offsetHours = round(abs($offset) / 3600);
        $offsetMinutes = round((abs($offset) - $offsetHours * 3600) / 60);
        $offsetString = ($offset < 0 ? '-' : '+')
            . ($offsetHours < 10 ? '0' : '') . $offsetHours
            . ($this->format == C::FORMAT_EXTENDED || $this->format == C::FORMAT_EXTENDED_SIGNED ? ':' : '')
            . ($offsetMinutes < 10 ? '0' : '') . $offsetMinutes;

        return $offsetString;
    }
157611
public static String getUTCNow()
  {
    SimpleDateFormat dateFormatGmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    dateFormatGmt.setTimeZone(TimeZone.getTimeZone("GMT"));

    //Time in GMT
    return dateFormatGmt.format(new Date());
  }
660225
public function getCurrentTime()
    {
        $time = $this->getFirstAttribute($this->schema->currentTime());

        return DateTime::createFromFormat($this->timestampFormat, $time)->getTimestamp();
    }
939118
public function getValue()
    {
        if ($this->value instanceof \DateTime) {
            $this->value->setTimezone(new \DateTimeZone('UTC'));

            return $this->value->format('Y-m-d\TH:i:s\Z');
        }

        return $this->value;
    }
969845
public function getDate()
	{
		$date = $this->created_at;
		if (Lang::has('laravel-comments::messages.date_timezone'))
		{
			$oldTimezone = date_default_timezone_get();
			$newTimezone = Lang::get('laravel-comments::messages.date_timezone');
			$date->setTimezone($newTimezone);
			date_default_timezone_set($newTimezone);
		}
		$locale = \App::getLocale();
		if (Lang::has('laravel-comments::messages.date_locale'))
		{
			$locale = Lang::get('laravel-comments::messages.date_locale');
		}
		setlocale(LC_TIME, $locale);
		$dateFormat = trans('laravel-comments::messages.date_format');
		if ($dateFormat == 'laravel-comments::messages.date_format')
		{
			$dateFormat = '%e %B %Y at %H:%M';
		}
		$date = $date->formatLocalized($dateFormat);
		if (Lang::has('laravel-comments::messages.date_timezone'))
		{
			date_default_timezone_set($oldTimezone);
		}
		return $date;
	}
154874
public function getJavascriptTimestamp()
    {
        $date = new \DateTime($this->time->format('Y-m-d H:i:s'));
        $javascriptTimestamp = $date->getTimestamp() * 1000;

        return $javascriptTimestamp;
    }
2136
private function getRFC1123DateString() {
        $date = new \DateTime(null, new \DateTimeZone("UTC"));
        return str_replace("+0000", "GMT", $date->format(\DateTime::RFC1123));
    }
1160225
public static function timezoneString() {
		// if site timezone string exists, return it
		if ( $timezone = get_option('timezone_string') ) {
			return $timezone;
		}
		// get UTC offset, if it isn't set then return UTC
		if ( ! $utc_offset = get_option('gmt_offset', 0) ) {
			return 'UTC';
		}
		// adjust UTC offset from hours to seconds
		$utc_offset *= 3600;
		// attempt to guess the timezone string from the UTC offset
		if ( $timezone = timezone_name_from_abbr('', $utc_offset, 0 ) ) {
			return $timezone;
		}
		// last try, guess timezone string manually
		$is_dst = date('I');
		foreach ( timezone_abbreviations_list() as $abbr ) {
			foreach ( $abbr as $city ) {
				if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) {
					return $city['timezone_id'];
				}
			}
		}
		
		// fallback to UTC
		return 'UTC';
	}
533885
public function getTimezone()
    {
        if(!$timezone = $this->getUser()->getTimezone())
        {
            if($timezones = $this->getTimezones()) {
                $timezone = $timezones[0];
            } else {
                $timezone = $this->getConfig()->timezone;
            }
        }

        return $timezone;
    }
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');
    }
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;
    }