DateTime::getTimezone
(PHP 5 >= 5.2.0)
DateTime::getTimezone — Return time zone relative to given DateTime
Beschreibung
Parameter-Liste
- object
-
Nur bei prozeduralem Aufruf: Ein von date_create() zurückgegebens DateTime Objekt.
Rückgabewerte
Returns DateTimeZone object on success or FALSE on failure.
Beispiele
Beispiel #1 Setting and getting DateTimeZone objects
<?php
date_default_timezone_set('Europe/London');
$datetime = new DateTime('2008-08-03 12:35:23');
echo $datetime->getTimezone()->getName() . "\n";
$datetime = new DateTime('2008-08-03 12:35:23');
$la_time = new DateTimeZone('America/Los_Angeles');
$datetime->setTimezone($la_time);
echo $datetime->getTimezone()->getName();
?>
Das oben gezeigte Beispiel erzeugt folgende Ausgabe:
Europe/London America/Los_Angeles
Siehe auch
- DateTime::setTimezone() - Sets the time zone for the DateTime object
- timezone_open() - Gibt ein neues DateTimeZone-Objekt zurück
DateTime::getTimezone
There are no user contributed notes for this page.
