Dutch PHP Conference 2025 - Call For Papers

DateTimeZone::getLocation

timezone_location_get

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

DateTimeZone::getLocation -- timezone_location_getReturns location information for a timezone

Опис

Об'єктно-орієнтований стиль

public DateTimeZone::getLocation(): array|false

Процедурний стиль

Returns location information for a timezone, including country code, latitude/longitude and comments.

Параметри

object

Тільки процедурний стиль: об'єкт DateTimeZone повертається функцією timezone_open()

Значення, що повертаються

Array containing location information about timezone або false в разі помилки.

Приклади

Приклад #1 DateTimeZone::getLocation() example

<?php
$tz
= new DateTimeZone("Europe/Prague");
print_r($tz->getLocation());
print_r(timezone_location_get($tz));
?>

Поданий вище приклад виведе:

Array
(
    [country_code] => CZ
    [latitude] => 50.08333
    [longitude] => 14.43333
    [comments] => 
)
Array
(
    [country_code] => CZ
    [latitude] => 50.08333
    [longitude] => 14.43333
    [comments] => 
)

Прогляньте також

  • DateTimeZone::listIdentifiers() - Returns a numerically indexed array containing all defined timezone identifiers to get a full or partial list of all supported timezone identifiers
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top