Returns the current year in the given time-zone, according to the given clock.

If no clock is provided, the system clock is used.

@param TimeZone   $timeZone
@param Clock|null $clock

@return Year
193335
public static function now(TimeZone $timeZone, Clock $clock = null) : Year
    {
        return new Year(LocalDate::now($timeZone, $clock)->getYear());
    }
557201
protected function isValidTimeZoneId($timeZone)
    {
        return ($this->isValidIanaTimeZoneId($timeZone) !== false || $this->isValidCldrTimeZoneId($timeZone) !== 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;
    }
974038
static function dateTime(?\DateTimeZone $timezone = null): \DateTime
    {
        if (self::$now !== null) {
            $now = \DateTime::createFromFormat('U.u', sprintf('%.6F', self::$now));
            $now->setTimezone($timezone ?? new \DateTimeZone(date_default_timezone_get()));

            return $now;
        }

        return new \DateTime('now', $timezone);
    }
445837
private function getDateParams($timezone)
    {
        $params    =[];
        $from      = new \DateTime('midnight', new \DateTimeZone($timezone));
        $from->sub(new \DateInterval('P30D'));
        $to    = new \DateTime('midnight', new \DateTimeZone($timezone));

        $from->setTimezone(new \DateTimeZone('UTC'));

        $to->add(new \DateInterval('P1D'))
            ->sub(new \DateInterval('PT1S'))
            ->setTimezone(new \DateTimeZone('UTC'));

        $params['dateFrom'] = $from->format('Y-m-d H:i:s');

        $params['dateTo'] = $to->format('Y-m-d H:i:s');

        return $params;
    }
604717
public static function createJalaliDate($year = null, $month = null, $day = null, $timezone = null)
    {
        return static::createJalali($year, $month, $day, null, null, null, $timezone);
    }
1227523
public function getTimezoneDisplayName($timezone)
    {
        $displayName = '';
        if (is_object($timezone)) {
            if ($timezone instanceof \DateTimeZone) {
                $displayName = $timezone->getName();
            } elseif ($timezone instanceof \DateTime) {
                $displayName = $timezone->getTimezone()->getName();
            }
        } elseif (is_string($timezone)) {
            $displayName = $timezone;
        }
        if (strlen($displayName) > 0) {
            $timezones = $this->getTimezones();
            if (array_key_exists($displayName, $timezones)) {
                $displayName = $timezones[$displayName];
            }
        }

        return $displayName;
    }
805464
public static function now(TimeZone $timeZone, Clock $clock = null) : LocalDate
    {
        return ZonedDateTime::now($timeZone, $clock)->getDate();
    }
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];
    }
50293
public Chronology getChronology(Object object, DateTimeZone zone) {
        return getChronology(object, (Chronology) null).withZone(zone);
    }
1240350
public static final SimpleMutableDateTime now(Clock clock)
    {
        ZonedDateTime zdt = ZonedDateTime.now(clock);
        SimpleMutableDateTime smt = SimpleMutableDateTime.from(zdt);
        return smt;
    }
498472
@Override
    public ChronoZonedDateTime<D> atZone(ZoneId zone) {
        return ChronoZonedDateTimeImpl.ofBest(this, zone, null);
    }
1035940
public function getCreatedAtDatetime(string $timezone = null): ?DateTime
    {
    	if ($this->created_at === null) {
    		return null;
	    }

        return new DateTime($this->created_at, new DateTimeZone($timezone ?? 'UTC'));
    }
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);
    }
754308
public static function now(string $format = 'Y-m-d H:i:s', string $timezone = null): string
    {
        return self::factory(null, $timezone)->format($format);
    }
38906
public static function now(?string $timezone = null): Time
    {
        $timezone = $timezone ?: date_default_timezone_get();
        assert(Validate::isTimezone($timezone), sprintf('Invalid timezone: %s', $timezone));

        $dateTime = new DateTimeImmutable('now', new DateTimeZone($timezone));
        $hour = (int) $dateTime->format('G');
        $minute = (int) $dateTime->format('i');
        $second = (int) $dateTime->format('s');

        return new static($hour, $minute, $second);
    }
1057586
public static function getMonthStart($ts = 'now', $format = 'U', $tz = null) {
		if (!Util::isValidTimezone($tz)) {
			$tz = Util::getClientTimezone();
		}
		
		$dt = new DateTime(null, new DateTimeZone($tz));
		(is_int($ts)) ? $dt->setTimestamp($ts) : $dt->modify($ts);

		$month = (int) $dt->format('m'); // month
		$year = (int) $dt->format('Y'); // year

		$dt->setDate($year, $month, 1);
		$dt->setTime(0, 0, 0);

		return $dt->format($format);
	}