Sets the time zone for which this <code>Calendar</code> will be resolved.

@param \DateTimeZone $timeZone The time zone to use for this Calendar, null if default should be used
744
public function setTimeZone(\DateTimeZone $timeZone = null)
    {
        if ($timeZone) {
            $value = $timeZone->getName();
        } else {
            $value = null;
        }

        $this->setValue('timezone', $value);
    }
732164
public function setTZ(DateTimeZone $time_zone)
    {
        $this->addSeconds($this->format('Z'));
        $result = $this->setTimezone($time_zone);
        $this->subtractSeconds($this->format('Z'));
        return $result;
    }
209737
public function setTimezone($value)
    {
        /** @var static $date */
        $date = parent::setTimezone(static::safeCreateDateTimeZone($value));
        // https://bugs.php.net/bug.php?id=72338
        // just workaround on this bug
        $date->getTimestamp();

        return $date;
    }
402655
public function setTimezone($timezone = 'UTC')
	{
		$this->current->setTimezone(is_string($timezone) ? new \DateTimeZone($timezone) : $timezone);
		return $this;
	}
192904
public void setTimezone(ICalProperty property, TimezoneAssignment timezone) {
		if (timezone == null) {
			TimezoneAssignment existing = propertyTimezones.remove(property);
			if (existing != null && existing != defaultTimezone && !propertyTimezones.values().contains(existing)) {
				assignments.remove(existing);
			}
			return;
		}

		assignments.add(timezone);
		propertyTimezones.put(property, timezone);
	}
91232
protected function withTimezone($timezone, $callback)
    {
        $currentTimezone = date_default_timezone_get();
        try {
            if ($timezone) {
                date_default_timezone_set($timezone);
            }
            return $callback();
        } finally {
            // Restore timezone
            if ($timezone) {
                date_default_timezone_set($currentTimezone);
            }
        }
    }
1231037
public static function setTimeZone($timezone)
    {
        if (self::_validateTimezone($timezone)) {
            self::$timezone = $timezone;
            return true;
        }
        return false;
    }
366685
public static function setTimeZone($timezone) {
		if (self::_validateTimezone($timezone)) {
			self::$_timezone = $timezone;
			return TRUE;
		}
		return FALSE;
	}
959176
public static function today($timeZone = null)
    {
        $now = null;
        $before = null;
        if ( is_null($timeZone) ) {
            $now = new \DateTime();
            $before = new \DateTime();
        } else {
            $now = new \DateTime( "now", new \DateTimeZone( $timeZone ) );
            $before = new \DateTime( "now", new \DateTimeZone( $timeZone ) );
        }
        $range = new Range( $before, $now );

        return $range;
    }
1223605
@SuppressWarnings("DeprecatedIsStillUsed")
    @Deprecated
    public void setTimeZone(TimeZone timeZone) {
        mTimezone = timeZone;
        mCalendar.setTimeZone(timeZone);
        YEAR_FORMAT.setTimeZone(timeZone);
        MONTH_FORMAT.setTimeZone(timeZone);
        DAY_FORMAT.setTimeZone(timeZone);
    }
127180
public function setTimeZone($timeZone)
    {
        if ($timeZone instanceof \IntlTimeZone) {
            $timeZone = $timeZone->getID();
        }

        if ($timeZone instanceof \DateTimeZone) {
            $timeZone = $timeZone->getName();

            // DateTimeZone returns the GMT offset timezones without the leading GMT, while our parsing requires it.
            if (!empty($timeZone) && ('+' === $timeZone[0] || '-' === $timeZone[0])) {
                $timeZone = 'GMT'.$timeZone;
            }
        }

        return $this->setTimeZoneId($timeZone);
    }
516079
public static function safeCreateDateTimeZone($timezone)
    {
        if ($timezone === null) {
            // Don't return null...
            return new DateTimeZone(date_default_timezone_get());
        }

        if ($timezone instanceof DateTimeZone) {
            return $timezone;
        }

        /** @noinspection PhpUsageOfSilenceOperatorInspection */
        $tz = @timezone_open((string) $timezone);

        if ($tz === false) {
            throw new Exception\InvalidArgumentException(
                sprintf(
                    'Unknown or bad timezone (%s)', is_scalar($timezone) ? $timezone : gettype($timezone)
                )
            );
        }

        return $tz;
    }
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;
	}
849475
public static function getTzOffset(string $timezone) : int
    {
        $dateTimeZone = new \DateTimeZone($timezone);
        $dateTimeZoneUtc = new \DateTimeZone('Europe/London');
        $dateTime = new \DateTime("now", $dateTimeZoneUtc);
        return $dateTimeZone->getOffset($dateTime);
    }
1104462
public function toDateTime(\DateTimeZone $timeZone = null): \DateTime
    {
        if (null === self::$utc) {
            self::$utc = new \DateTimeZone('UTC');
        }

        $date = \DateTime::createFromFormat('!Y-m-d', $this->getValue(), $timeZone ?: self::$utc);
        if (!$date instanceof \DateTime) {
            $date = \DateTime::createFromFormat('!Y-m-d', (new \DateTime())->format('Y-m-d'), $timeZone ?: self::$utc);
        }

        if ($date->getOffset() !== 0) {
            $date->setTimezone(self::$utc);
        }

        return $date;
    }
1328369
public function getUpdatedAtDatetime(string $timezone = null): ?DateTime
    {
        if (!$this->hasUpdatedAt()) {
            return null;
        }

        if ($timezone === null) {
            $timezone = 'UTC';
        }

        return new DateTime($this->getUpdatedAt(), new DateTimeZone($timezone));
    }
697180
protected function changeTimezone()
    {
        $this->previousTimezone=false;
        if ($this->timezone) {
            $this->previousTimezone=date_default_timezone_get();
            date_default_timezone_set($this->timezone);
        }
    }