PHP 5.6.22 is available

List of Supported Timezones

Table of Contents

Here you'll find the complete list of timezones supported by PHP, which are meant to be used with e.g. date_default_timezone_set().

Note: The latest version of the timezone database can be installed via PECL's » timezonedb.

Note: This list is based upon the timezone database version 2010.9.

add a note add a note

User Contributed Notes 5 notes

up
1
wimarbueno at gmail dot com,Wilzon Mario Bueno
1 month ago
Se genera la lista de zonas horarias de forma dinámica, y por lo tanto se actualiza automáticamente cuando se podrían cambiar las zonas horarias (en PHP).

function timezone_list() {
    static $timezones = null;

    if ($timezones === null) {
        $timezones = [];
        $offsets = [];
        $now = new DateTime();

        foreach (DateTimeZone::listIdentifiers() as $timezone) {
            $now->setTimezone(new DateTimeZone($timezone));
            $offsets[] = $offset = $now->getOffset();
            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
        }

        array_multisort($offsets, $timezones);
    }

    return $timezones;
}

function format_GMT_offset($offset) {
    $hours = intval($offset / 3600);
    $minutes = abs(intval($offset % 3600 / 60));
    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
}

function format_timezone_name($name) {
    $name = str_replace('/', ', ', $name);
    $name = str_replace('_', ' ', $name);
    $name = str_replace('St ', 'St. ', $name);
    return $name;
}

// Uso
$timezone = timezone_list();
echo '<pre>';
    print_r($timezone);
echo '</pre>';

// Aquí es un ejemplo de la salida:
Array
(
    [Pacific/Midway]    => (GMT-11:00) Pacific, Midway
    [Pacific/Niue]      => (GMT-11:00) Pacific, Niue
    [Pacific/Pago_Pago] => (GMT-11:00) Pacific, Pago Pago
    [America/Adak]      => (GMT-10:00) America, Adak
    [Pacific/Honolulu]  => (GMT-10:00) Pacific, Honolulu
    [Pacific/Johnston]  => (GMT-10:00) Pacific, Johnston
    [Pacific/Rarotonga] => (GMT-10:00) Pacific, Rarotonga
    [Pacific/Tahiti]    => (GMT-10:00) Pacific, Tahiti
    [Pacific/Marquesas] => (GMT-09:30) Pacific, Marquesas
    [America/Anchorage] => (GMT-09:00) America, Anchorage
    [America/Juneau]    => (GMT-08:00) America, Juneau
    [America/Metlakatla] => (GMT-08:00) America, Metlakatla
    [America/Nome]      => (GMT-08:00) America, Nome
    [America/Sitka]     => (GMT-08:00) America, Sitka
    [America/Yakutat]   => (GMT-08:00) America, Yakutat
    [Pacific/Pitcairn]  => (GMT-08:00) Pacific, Pitcairn
    [America/Creston]   => (GMT-07:00) America, Creston
    [America/Dawson]    => (GMT-07:00) America, Dawson
    ...
)
up
-2
William
1 year ago
To get a list programmatically, I use \DateTimeZone::listIdentifiers() (you may encounter its alias timezone_identifiers_list()): http://php.net/DateTimeZone.listIdentifiers
up
-1
hacker at gaucho dot com
1 month ago
why the corresponding GMT to São Paulo is like "Etc/GMT + 3" and not "Etc/GMT-3?
up
-15
aayaresko at gmail dot com
5 months ago
to know time zones offset in seconds and hours I used this method.
<?php
$time_zones
= $timezone_identifiers = \DateTimeZone::listIdentifiers();
        foreach (
$time_zones as $time_zone) {
           
$date = new \DateTime('now', new \DateTimeZone($time_zone));
           
$offset_in_hours = $date->getOffset() / 60 / 60;
            if (!
is_null($offset) && $offset == $offset_in_hours) {
                echo
"{$time_zone}: {$date->getOffset()} ($offset_in_hours)<br>";
            }
        }
?>
up
-21
mblaney at gmail dot com
11 months ago
Follow up to William's helpful advice:
php -r 'echo join(timezone_identifiers_list(), ",");'
To Top