Home >>PHP Date Time Functions >PHP timezone_location_get() Function

PHP timezone_location_get() Function

PHP timezone_location_get() Function

PHP timezone_location_get() function is used to find the location information for the given timezone. It accepts only a single parameter $object which specify the DateTimeZone object. It returns the location information related to the given timezone on success and False on failure.

Syntax:

timezone_location_get(object);

Parameter Values

Parameter Description
object This is a required parameter. This parameter defines a DateTimeZone object returned by timezone_open().

Here is an example of timezone_location_get() function in PHP:

<html>
<body>
<pre>
<?php
$timezone=timezone_open("Asia/kolkata");
print_r(timezone_location_get($timezone));
?>
</pre>
</body>
</html>
Output:
Array
(
    [country_code] => IN
    [latitude] => 22.53333
    [longitude] => 88.36666
    [comments] => 
)

Example 2:

<html>
<body>
<pre>
<?php
$timezone=timezone_open("Atlantic/Stanley");
print_r(timezone_location_get($timezone));
?>
</pre>
</body>
</html>
Output:
Array
(
    [country_code] => FK
    [latitude] => -51.7
    [longitude] => -57.85
    [comments] => 
)

No Sidebar ads