constructor for calendar component VTIMEZONE object

@author Kjell-Inge Gustafsson <ical@kigkonsult.se>
@since 0.3.0 - 2006-08-13
@param string $timezonetype optional, default FALSE ( STANDARD / DAYLIGHT )
@return void
492826
function vtimezone( $timezonetype=FALSE ) {
    if( !$timezonetype )
      $this->timezonetype = 'VTIMEZONE';
    else
      $this->timezonetype = strtoupper( $timezonetype );
    $this->calendarComponent();
  }
1363326
public function setTimezone($timezone)
    {
        try {
            $test = new \DateTimeZone($timezone);
            $this->timezone = $timezone;
        } catch (\Exception $e) {
            throw new MonetivoException('Invalid timezone');
        }
    }
1128581
protected function calculateTimezone($timezone)
    {
        if (!isset($timezone)) {
            return null;
        }
        $key = $timezone instanceof \DateTimeZone ? $timezone->getName() : $timezone;
        // lazy loading
        if (!isset(static::$timezonesInstances[$key])) {
            static::$timezonesInstances[$key] = is_string($timezone) ? new \DateTimezone($timezone) : $timezone;
        }
        return static::$timezonesInstances[$key];
    }
1374319
public final void setTimeZone(final TimeZone timeZone) {
        if (!Value.DATE.equals(type)) {
            for (Date date: this) {
                ((DateTime) date).setTimeZone(timeZone);
            }
        }
        this.timeZone = timeZone;
        this.utc = false;
    }
323206
public static function createFromTimestamp(?int $timestamp = null, ?string $timeZone = null): DateTimeInterface
    {
        $dateTimeZone = is_string($timeZone) ? new DateTimeZone($timeZone) : null;
        $timestamp = is_int($timestamp) ? $timestamp : time();

        $dateTime = new DateTimeImmutable('now', $dateTimeZone);

        return $dateTime->setTimestamp($timestamp);
    }
1229941
public function setDateByTimezone($timezone) {
    if (is_string($timezone)) {
      $timezone = new DateTimeZone($timezone);
    }
    $this->convertedTimezone = $timezone;
    $new_date_utc = $this->date->getTimeStamp() - $timezone->getOffset($this->date);
    $new_date = new DateTime();
    $new_date->setTimestamp($new_date_utc);
    $this->date = $new_date;
  }
93407
private function setTimezones()
    {
        foreach(\DateTimeZone::listIdentifiers() as $identifier) {
            $key = strtolower(str_replace('/', '_', $identifier));
            $this->valueOptions[] = new Option($key, $identifier);
        }
    }
887473
protected function getTimezoneObject($timezone) {
		if(!isset($this->timezonesObjects[$timezone])) {
			$this->timezonesObjects[$timezone] = new \DateTimezone($timezone);
		}
		return $this->timezonesObjects[$timezone];
	}
248442
public function setTimezone($timezone)
    {
        if (self::$_immutable) {
            self::$_immutable = false;
            $newDate = clone $this;
            $newDate->setTimezone($timezone);
            self::$_immutable = true;

            return $newDate;
        } else {
            return parent::setTimezone($timezone);
        }
    }
1166756
public function setEndTimezone($timezone = 'UTC')
	{
		$this->end->setTimezone(is_string($timezone) ? new \DateTimeZone($timezone) : $timezone);
		return $this;
	}
697180
protected function changeTimezone()
    {
        $this->previousTimezone=false;
        if ($this->timezone) {
            $this->previousTimezone=date_default_timezone_get();
            date_default_timezone_set($this->timezone);
        }
    }
190837
public static function typecast(&$value, $type)
    {
        switch ($type) {
            case Validate::TYPE_INT:
            case Validate::TYPE_UINT:
                $value = intval($value);
                break;
            case Validate::TYPE_FLOAT:
                $value = floatval($value);
                break;
            case Validate::TYPE_DOUBLE:
                $value = doubleval($value);
                break;
            case Validate::TYPE_BOOLEAN:
                $value = boolval($value);
                break;
            case Validate::TYPE_UNIX_TIMESTAMP:
                //Add the timezone offset (in minutes)
                $value = intval($value) +
                    (\Phramework\Phramework::getTimezoneOffset()*60);
                break;
        }
    }
951275
public static function factory($time = null, string $timezone = null): \DateTime
    {
        if (! $timezone instanceof \DateTimeZone) {
            $timezone = $timezone ?: date_default_timezone_get();
            $timezone = new \DateTimeZone($timezone);
        }

        if ($time instanceof \DateTime) {
            return $time->setTimezone($timezone);
        }

        $datetime = new \DateTime('@' . self::timestamp($time));
        return $datetime->setTimezone($timezone);
    }
736583
public function setDefaultTimezone($defaultTimezone)
    {
        Piwik::checkUserHasSuperUserAccess();
        $this->checkValidTimezone($defaultTimezone);
        Option::set(self::OPTION_DEFAULT_TIMEZONE, $defaultTimezone);
        return true;
    }
569317
public function withTimeZone(\DateTimeZone $timezone)
    {
        date_default_timezone_set($timezone->getName());

        return new self(
            new Hour((string)$this->getHour()),
            new Minute((string)$this->getMinutes()),
            new Second((string)$this->getSeconds())
        );
    }
185949
public function setTimezone($timezone = null)
	{
		$this->date->setTimezone($timezone === null ? self::$utc : is_string($timezone) ? ($timezone === 'UTC' ? self::$utc : new \DateTimeZone($timezone)) : ($timezone instanceof \DateTimeZone ? $timezone : $timezone->getTimezone()));
		return $this;
	}
709830
public function datetime(string $format, \DateTimeZone $timeZone = null) : DateFieldBuilder
    {
        return $this->dateTypeBuilder(new DateTimeType($format, $timeZone));
    }