date_timezone_get()
date_timezone_get() — Alias of DateTime::getTimezone().
Built-in function of PHP 8.5. The manual lists it as available in PHP 5 >= 5.2.0, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
date_timezone_get() is an alias of DateTime::getTimezone(): same parameters, same return value.
Signature
date_timezone_get(DateTimeInterface $object): DateTimeZone|false
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $object | DateTimeInterface | Procedural style only: A DateTime object returned by date_create() |
Return value
Returns a DateTimeZone object on success or false on failure.
Example
A runnable snippet:
$date = new DateTimeImmutable("now", new DateTimeZone('Europe/London')); $tz = $date->getTimezone(); echo $tz->getName();
Output:
Europe/London
All PHP 8.5 built-in functions
Reference card built from the PHP manual page date_timezone_get() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.