PHP 日期和时间函数

PHP timezone_location_get() 函数用于显示给定时区的位置信息。

语法

timezone_location_get(object); 

参数

Object:指定一个DateTimeZone对象。

返回

成功返回数组,失败返回 FALSE。

例子1

<?php
$timezone=timezone_open("Asia/Shanghai");
print_r(timezone_location_get($timezone));
?> 

输出:

Array
(
    [country_code] => CN
    [latitude] => 31.23333
    [longitude] => 121.46666
    [comments] => Beijing Time
)

例子2

<?php
$timezone=timezone_open("Europe/Zagreb ");
print_r(timezone_location_get($timezone));
?> 

输出:

Array
(
[country_code] => HR
[latitude] => 45.8
[longitude] => 15.96666
[comments] =>
)

示例 3

<?php
$timezone=timezone_open("Europe/Paris  ");
print_r(timezone_location_get($timezone));
?> 

输出:

Array
(
[country_code] => FR
[latitude] => 48.86666
[longitude] => 2.33333
[comments] =>
)