English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Date & Time Functions Manual
The timezone_location_get() function returns the location information of the timezone
The timezone_location_get() function returns the location information of the timezone, including country code and latitude/Longitude and comments.
timezone_location_get( DateTimeZone $object );
Number | Parameters and Description |
---|---|
1 | Object (required) The DateTimeZone object returned by timezone_open() |
An array containing information about the timezone location, or False on failure.
This function was initially introduced in PHP version5.3.0 was introduced and is available for all higher versions.
DateTimeZone::getLocation() Example-
<?php $tz = new DateTimeZone("Asia/Shanghai); print_r($tz->getLocation()); print_r(timezone_location_get($tz)); ?>Test and See‹/›
Output Result
Array ( [country_code] => CN [latitude] => 31.23333 [longitude] => 121.46666 [comments] => Beijing Time ) Array ( [country_code] => CN [latitude] => 31.23333 [longitude] => 121.46666 [comments] => Beijing Time )