array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'tr', ), 'this' => array ( 0 => 'datetime.gettimezone.php', 1 => 'DateTimeInterface::getTimezone', ), 'up' => array ( 0 => 'class.datetimeinterface.php', 1 => 'DateTimeInterface', ), 'prev' => array ( 0 => 'datetime.gettimestamp.php', 1 => 'DateTimeInterface::getTimestamp', ), 'next' => array ( 0 => 'datetime.wakeup.php', 1 => 'DateTime::__wakeup', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/datetime/datetimeinterface/gettimezone.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
DateTimeInterface::getTimezone -- DateTimeImmutable::getTimezone -- DateTime::getTimezone -- date_timezone_get — Return time zone relative to given DateTime
Nesne yönelimli kullanım
Yordamsal kullanım
Return time zone relative to given DateTime.
nesne
Sadece yordamsal biçem: date_create() işlevinden dönen bir DateTime nesnesi.
Returns a DateTimeZone object on success
başarısızlık durumunda false
döner.
Örnek 1 DateTime::getTimezone() example
Nesne yönelimli kullanım
<?php
$date = new DateTimeImmutable(null, new DateTimeZone('Europe/London'));
$tz = $date->getTimezone();
echo $tz->getName();
?>
Yordamsal kullanım
<?php
$date = date_create(null, timezone_open('Europe/London'));
$tz = date_timezone_get($date);
echo timezone_name_get($tz);
?>
Yukarıdaki örneklerin çıktısı:
Europe/London