Get the timezone string from the timezone code

@param string $sCode The timezone code, e.g. GMT

@return string|false
346324
public static function getTimezoneFromCode($sCode)
    {
        $aAbbreviations = \DateTimeZone::listAbbreviations();
        foreach ($aAbbreviations as $sTzCode => $aValues) {
            if (strtolower($sCode) == $sTzCode) {
                $aTimeZone = reset($aValues);
                return getFromArray('timezone_id', $aTimeZone, false);
            }
        }

        return false;
    }
1328025
protected function _getCountryByCode($sCountryCode)
    {
        //default country
        $sCountry = 'international';

        if (!empty($sCountryCode)) {
            $aLangIds = \OxidEsales\Eshop\Core\Registry::getLang()->getLanguageIds();
            $iEnglishId = array_search("en", $aLangIds);
            if (false !== $iEnglishId) {
                $sViewName = getViewName("oxcountry", $iEnglishId);
                $sQ = "select oxtitle from {$sViewName} where oxisoalpha2 = " . \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quote($sCountryCode);
                // Value does not change that often, reading from slave is ok here (see ESDEV-3804 and ESDEV-3822).
                $sCountryName = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getOne($sQ);
                if ($sCountryName) {
                    $sCountry = $sCountryName;
                }
            } else {
                // handling when english language is deleted
                switch ($sCountryCode) {
                    case 'de':
                        return 'germany';
                    default:
                        return 'international';
                }
            }
        }

        return strtolower($sCountry);
    }
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);

    }
297790
public function getDeletedAtDatetime(string $timezone = null): ?DateTime
    {
        if (!$this->isDeleted()) {
            return null;
        }

        return new DateTime($this->getDeletedAt(), new DateTimeZone($timezone ?? 'UTC'));
    }
1122945
public function findTimezones($countryCode)
    {
        return $this->helper->loadJson(
            $this->helper->dataDir('timezones/countries/default/'.strtolower($countryCode).'.json')
        );
    }
470128
def timezone(self):
        
        if self._tz is None:
            # GET CENTROID FROM GSSHA GRID
            cen_lat, cen_lon = self.centerLatLon()
            # update time zone
            tf = TimezoneFinder()
            tz_name = tf.timezone_at(lng=cen_lon, lat=cen_lat)

            self._tz = timezone(tz_name)
        return self._tz
533885
public function getTimezone()
    {
        if(!$timezone = $this->getUser()->getTimezone())
        {
            if($timezones = $this->getTimezones()) {
                $timezone = $timezones[0];
            } else {
                $timezone = $this->getConfig()->timezone;
            }
        }

        return $timezone;
    }
799215
protected function getOffsetFromLocation(string $zone): string
    {
        $zone = new DateTimeZone($zone);
        $gmt = new DateTimeZone(self::GMT);

        return $zone->getOffset(new \DateTime('now', $gmt));
    }
254832
public function getTimezone()
    {
        $dateTime = new Date();
        $dateTime->setTimeZone(new DateTimeZone($this->cachetTimezone));

        return $dateTime->format('T');
    }
1276112
public static function isValidTimezone($timezone) {
		static $cache;
		if (!is_array($cache)) {
			$cache = array();
		}
		
		if (isset($cache[$timezone])) {
			return $cache[$timezone];
		}
		
		$cache[$timezone] = in_array($timezone, DateTimeZone::listIdentifiers());
		return $cache[$timezone];
	}
1249213
def get_timezone(as_timedelta=False):
    
    try:
        offset_hour = -(time.altzone if time.daylight else time.timezone)
    except Exception as e:
        offset_hour = -(datetime.datetime.now() -
                        datetime.datetime.utcnow()).seconds

    offset_hour = offset_hour // 3600
    offset_hour = offset_hour if offset_hour < 10 else offset_hour // 10

    if as_timedelta:
        return datetime.timedelta(hours=offset_hour)

    return 'Etc/GMT%+d' % offset_hour
369124
public static TimeZone timeZoneForName(String tzString) {
        // This is a horrible hack since there is no easier way to get a timezone
        // only if the string is recognized as a timezone.
        // The TimeZone.getTimeZone javadoc says the following:
        //   Returns:
        //       the specified TimeZone, or the GMT zone if the given ID cannot be
        //       understood.
        TimeZone tz = TimeZone.getTimeZone(tzString);
        if (tz.hasSameRules(BOGUS_TIMEZONE)) {
            // see if the user really was asking for GMT because if
            // TimeZone.getTimeZone can't recognize tzString, then that is what it
            // will return.
            Matcher m = UTC_TZID.matcher(tzString);
            if (m.matches()) {
                return TimeUtils.utcTimezone();
            }
            // unrecognizable timezone
            return null;
        }
        return tz;
    }
138109
public function getByCode($sCode)
    {
        $aLanguages = $this->getAll();
        return !empty($aLanguages[$sCode]) ? $aLanguages[$sCode] : false;
    }
793845
public function format($sCode, $nValue, $bIncludeSymbol = true)
    {
        try {

            $oCurrency = $this->getByIsoCode($sCode);
            $sOut      = number_format(
                $nValue,
                $oCurrency->decimal_precision,
                $oCurrency->decimal_symbol,
                $oCurrency->thousands_separator
            );

            if ($bIncludeSymbol) {
                if ($oCurrency->symbol_position == 'BEFORE') {
                    $sOut = $oCurrency->symbol . $sOut;
                } else {
                    $sOut = $sOut . $oCurrency->symbol;
                }
            }

            return $sOut;

        } catch (\Exception $e) {
            return '[CURRENCY FORMATTING FAILED: ' . $e->getMessage() . ']';
        }
    }
1264125
public function getDatetime($data, $timezone = null)
    {
        if ($data instanceof \DateTime) {
            return $data;
        }

        if ($data instanceof \DateTimeImmutable) {
            return \DateTime::createFromFormat(\DateTime::ATOM, $data->format(\DateTime::ATOM));
        }

        // the format method accept array or integer
        if (is_numeric($data)) {
            $data = (int) $data;
        }

        if (\is_string($data)) {
            $data = strtotime($data);
        }

        $date = new \DateTime();
        $date->setTimestamp($data);
        $date->setTimezone(new \DateTimeZone($timezone ?: $this->timezoneDetector->getTimezone()));

        return $date;
    }
205241
def _to_timezone(self, dt):
        """"""
        tz = self._get_tz()
        utc_dt = pytz.utc.localize(dt)
        return utc_dt.astimezone(tz)
966716
static function fetchByHttpLocaleCode( $httpLocaleCode )
    {
        $locales = self::localeList( true );
        foreach ( $locales as $locale )
        {
            if ( $locale->httpLocaleCode() == $httpLocaleCode )
                return $locale;
        }

        return false;
    }