Create a new DateTimeZone object and return its timezone name.
| <?php $tz=timezone_open(“Europe/Paris”); echo timezone_name_get($tz); ?> |
The timezone_open() function creates a new DateTimeZone object.
The two functions below are equivalent and either can be used, as demonstrated in the example above.
Procedural style:
| timezone_open(timezone) |
Object oriented style:
| DateTimeZone::__construct(timezone) |
|
Parameter |
Description |
|
timezone |
Required. Specifies a timezone. Tip: Consult the list of all supported timezones in PHP. |
|
Return Value: |
Returns the DateTimeZone object on success, or FALSE on failure. |
|
PHP Version: |
5.2+ |
|
PHP Changelog: |
PHP 5.5.1: The timezone parameter now accepts offset values. |