PHP - Funktion date_timezone_set()
Beispiel
Legen Sie die Zeitzone für das DateTime-Objekt fest:
<?php
$date=date_create("2013-05-25",timezone_open("Indian/Kerguelen"));
echo date_format($date,"Y-m-d H:i:sP");
?>
Definition und Verwendung
Die Funktion date_timezone_set() legt die Zeitzone für das DateTime-Objekt fest.
Syntax
date_timezone_set(object, timezone)
Parameterwerte
Parameter | Description |
---|---|
object | Required. Specifies a DateTime object returned by date_create(). This function modifies this object |
timezone | Required. Specifies a DateTimeZone object that represents the desired time zone. Tip: Look at a list of all supported timezones in PHP |
Technische Details
Rückgabewert: | Gibt das DateTime-Objekt für die Methodenverkettung zurück. FALSE bei Fehler |
---|---|
PHP-Version: | 5.2+ |
Änderungsprotokoll: | PHP 5.3: Rückgabewert von NULL auf DateTime geändert (bei Erfolg) |
❮ PHP-Datums-/Zeitreferenz