Create a new DateTimeZone object, then return the name of the timezone:
<?php
$tz=timezone_open("Europe/Paris");
echo timezone_name_get($tz);
?>
Try it Yourself »
The timezone_open() creates a new DateTimeZone object.
The two functions below are equivalent and any of the functions can be used as shown in the example above.
Procedural style:
timezone_open(
timezone)
Object oriented style:
DateTimeZone::__construct(
timezone)
Parameter | Description |
---|---|
timezone | Required. Specifies a timezone Tip: Look at a list of all supported timezones in PHP |
Return Value: | Returns the DateTimeZone object on success. FALSE on failure |
---|---|
PHP Version: | 5.2+ |
PHP Changelog: | PHP 5.5.1: The timezone parameter accepts offset values |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!