Signature
timezone_abbreviations_list(): arrayPurpose
timezone_abbreviations_list() returns the table of timezone abbreviations that PHP knows about, such as est, cet or utc. Each abbreviation maps to one or more candidate zones, because an abbreviation alone is often ambiguous. The function is a procedural alias of DateTimeZone::listAbbreviations(), so both calls give the same result.
Typical uses are inspecting what an abbreviation could mean, building a diagnostic page, or checking whether a string looks like an abbreviation PHP recognizes. It is not a good tool for choosing a user's timezone. Identifiers such as America/New_York carry full daylight-saving rules, while an abbreviation carries only a fixed offset.
Signature
Parameters and defaults
The function takes no parameters, so there are no defaults to configure. You cannot filter by region or offset. Filter the returned array in your own code.
Return value
The return value is an array. Its keys are lowercase abbreviation strings. Each value is a list of arrays, one per candidate zone, with three keys:
dst: a boolean that istrueif the abbreviation refers to daylight saving time.offset: an integer offset from UTC in seconds. Negative values are west of UTC.timezone_id: a string such asAmerica/New_York, ornullwhen the entry has no associated identifier.
The manual page for this function only documents it as an alias, so the entry layout above follows the documented DateTimeZone::listAbbreviations() result.
Failure cases
The function has no arguments to validate and does not signal errors in normal use. It always returns an array. The contents come from the timezone data bundled with your PHP build, so do not hard-code the number of abbreviations or the order of entries. They can differ between builds.
Example 1: reading an offset
The est key holds several candidates. The code below searches for the one tied to America/New_York and converts its offset from seconds to hours.
$list = timezone_abbreviations_list();
$found = null;
foreach ($list['est'] as $entry) {
if ($entry['timezone_id'] === 'America/New_York') {
$found = $entry;
break;
}
}
echo json_encode([
'offset' => $found['offset'] ?? null,
'hours' => isset($found) ? intdiv($found['offset'], 3600) : null,
'dst' => $found['dst'] ?? null,
]), "\n";{"offset":-18000,"hours":-5,"dst":false}
Searching by timezone_id is safer than taking the first entry, because the order of candidates is not something your code should depend on.
Example 2: validating the structure
This example walks every entry and checks the type of each field. It confirms the shape described above.
$list = timezone_abbreviations_list();
$valid = true;
foreach ($list as $abbr => $entries) {
foreach ($entries as $entry) {
$idOk = is_string($entry['timezone_id']) || $entry['timezone_id'] === null;
if (!is_bool($entry['dst']) || !is_int($entry['offset']) || !$idOk) {
$valid = false;
}
}
}
echo json_encode(['valid' => $valid, 'hasUtc' => array_key_exists('utc', $list)]), "\n";{"valid":true,"hasUtc":true}
Notice that timezone_id is checked for null as well as for a string. Code that assumes a string may fail on an entry without an identifier.
Example 3: key case and the alias
The keys are lowercase. Looking up an uppercase abbreviation fails unless you normalize it first. The last line confirms the alias relationship with the class method.
$list = timezone_abbreviations_list();
echo json_encode([
'EST' => array_key_exists('EST', $list),
'est' => array_key_exists('est', $list),
'same_as_class_method' => $list === DateTimeZone::listAbbreviations(),
]), "\n";{"EST":false,"est":true,"same_as_class_method":true}
Edge cases
- One abbreviation, many zones. An abbreviation can match several regions, and some may have different offsets. Treat each value as a list of candidates, never as one answer.
- Fixed offsets only. An entry describes one offset and one
dstflag. It does not describe when daylight saving starts or ends. - Large result. The array is sizable. Call it once and reuse the result instead of calling it inside a loop.
- Data varies by build. Updating PHP or its timezone database can change the contents. Write tests against stable facts, such as the structure, rather than exact counts.
Common mistakes
- Using an uppercase key such as
$list['EST']and getting an undefined key warning. Lowercase the abbreviation withstrtolower()first, or check witharray_key_exists(). - Taking
$list['cst'][0]as the answer.cstcan refer to more than one region, and the first entry is arbitrary for your purposes. - Storing abbreviations as a user's timezone setting. Store an identifier such as
Europe/Parisinstead. - Treating
offsetas minutes or hours. It is in seconds. - Assuming
timezone_idis always a string.
Related functions
DateTimeZone::listAbbreviations(), the method this function aliases.timezone_identifiers_list(), which lists full identifiers such asEurope/Paris.timezone_name_from_abbr(), which maps an abbreviation or offset to an identifier.timezone_open(), which creates aDateTimeZoneobject.
Recap
timezone_abbreviations_list() takes no arguments and returns an array of lowercase abbreviations. Each maps to a list of candidates with dst, offset and timezone_id. It is an alias of DateTimeZone::listAbbreviations(). Search the candidates deliberately, handle a null identifier, remember that offsets are in seconds, and prefer full timezone identifiers for real application logic.
Tested examples
$list = timezone_abbreviations_list();
$found = null;
foreach ($list['est'] as $entry) {
if ($entry['timezone_id'] === 'America/New_York') {
$found = $entry;
break;
}
}
echo json_encode([
'offset' => $found['offset'] ?? null,
'hours' => isset($found) ? intdiv($found['offset'], 3600) : null,
'dst' => $found['dst'] ?? null,
]), "\n";
{"offset":-18000,"hours":-5,"dst":false}
$list = timezone_abbreviations_list();
$valid = true;
foreach ($list as $abbr => $entries) {
foreach ($entries as $entry) {
$idOk = is_string($entry['timezone_id']) || $entry['timezone_id'] === null;
if (!is_bool($entry['dst']) || !is_int($entry['offset']) || !$idOk) {
$valid = false;
}
}
}
echo json_encode(['valid' => $valid, 'hasUtc' => array_key_exists('utc', $list)]), "\n";
{"valid":true,"hasUtc":true}
$list = timezone_abbreviations_list();
echo json_encode([
'EST' => array_key_exists('EST', $list),
'est' => array_key_exists('est', $list),
'same_as_class_method' => $list === DateTimeZone::listAbbreviations(),
]), "\n";
{"EST":false,"est":true,"same_as_class_method":true}