PHP timezone_identifiers_list() Function

Beginner
5 min read
Updated: Nov 2026
3 examples
Date/Time

Definition

In PHP, timezone_identifiers_list() returns an array of time zone identifiers, such as Europe/London or Asia/Kolkata.

By default it returns every standard identifier. You can limit the list to one region, like Europe or America, or to the zones used by a single country. It is the procedural version of DateTimeZone::listIdentifiers() and is handy for building a time zone drop-down.

Syntax

Call timezone_identifiers_list() with the values you need. Start with this line.

PHP
$ids = timezone_identifiers_list();
CallWhat it does
timezone_identifiers_list()Returns all standard time zone identifiers.
timezone_identifiers_list(DateTimeZone::EUROPE)Returns only the identifiers in the Europe group.
timezone_identifiers_list(DateTimeZone::PER_COUNTRY, 'IN')Returns the identifiers used by one country, here India.

The list is sorted alphabetically. When you use DateTimeZone::PER_COUNTRY you must also pass a two-letter ISO 3166-1 country code, otherwise PHP throws a ValueError.

Library declarations
PHP
timezone_identifiers_list(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null): array

Parameters

ParameterDescription
timezoneGroupOptional. One of the DateTimeZone group constants, such as ALL, AFRICA, AMERICA, ASIA, EUROPE, PACIFIC, UTC or PER_COUNTRY. The default is DateTimeZone::ALL.
countryCodeOptional. A two-letter country code such as US or IN. It is required when the group is DateTimeZone::PER_COUNTRY and ignored otherwise.

Return Value

Return ValueDescription
arrayA list of time zone identifier strings, sorted alphabetically.

PHP Examples

Example 1 — Counting and Checking Identifiers

The full list is long, so this example prints only the first three identifiers and checks a few names with in_array().

PHP
<?php
$ids = timezone_identifiers_list();

var_dump(count($ids) > 300);

echo $ids[0], PHP_EOL;
echo $ids[1], PHP_EOL;
echo $ids[2], PHP_EOL;

var_dump(in_array('Asia/Kolkata', $ids));
var_dump(in_array('Europe/London', $ids));
var_dump(in_array('Mars/Base', $ids));

How It Works

  1. With no arguments, the function returns every standard identifier.
  2. count() shows the list holds more than 300 names.
  3. The list is alphabetical, so the first entries come from Africa.
  4. in_array() confirms that real zones are present and that a made-up zone is not.

Example 2 — Filtering by Region

Pass a group constant to get only the zones for one part of the world.

PHP
<?php
$europe = timezone_identifiers_list(DateTimeZone::EUROPE);

echo "First: ", $europe[0], PHP_EOL;
echo "Second: ", $europe[1], PHP_EOL;

var_dump(in_array('Europe/London', $europe));
var_dump(in_array('Asia/Tokyo', $europe));

$onlyEurope = array_filter($europe, function ($id) {
    return strpos($id, 'Europe/') === 0;
});
var_dump(count($onlyEurope) === count($europe));

How It Works

  1. DateTimeZone::EUROPE limits the result to identifiers that start with Europe/.
  2. The first two names in alphabetical order are Amsterdam and Andorra.
  3. London is in the list, but Tokyo belongs to Asia, so it is not.
  4. array_filter() checks the prefix of every name, and all of them start with Europe/.

Example 3 — Zones for One Country

Use DateTimeZone::PER_COUNTRY together with a country code to list the zones that a single country uses.

PHP
<?php
$india = timezone_identifiers_list(DateTimeZone::PER_COUNTRY, 'IN');
echo "India zones: ", count($india), PHP_EOL;
echo $india[0], PHP_EOL;

$us = timezone_identifiers_list(DateTimeZone::PER_COUNTRY, 'US');
var_dump(count($us) > 1);
var_dump(in_array('America/New_York', $us));
var_dump(in_array('America/Los_Angeles', $us));

How It Works

  1. PER_COUNTRY needs the second argument, here the code IN for India.
  2. India uses one time zone, so the list has a single item: Asia/Kolkata.
  3. The United States spans many zones, so its list has more than one item.
  4. New York and Los Angeles are both listed for US.

Frequently Asked Questions

It returns an array of time zone identifier strings like America/New_York or Asia/Tokyo, sorted alphabetically.
Call timezone_identifiers_list(DateTimeZone::PER_COUNTRY, 'US'), replacing US with a two-letter ISO country code. The second argument is required with PER_COUNTRY.
Pass a group constant as the first argument, for example DateTimeZone::EUROPE, DateTimeZone::ASIA or DateTimeZone::AMERICA.
Yes. The function is the procedural alias of DateTimeZone::listIdentifiers(), and both take the same arguments and return the same array.
Use in_array($name, timezone_identifiers_list(), true). This is a simple and reliable check before you pass the name to date_default_timezone_set() or timezone_open().

Next: timezone_location_get()

timezone_location_get() returns location information for a time zone, such as its country .

timezone_location_get() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful