PHP DateTimeZone - listAbbreviations() Method
The PHP DateTimeZone::listAbbreviations() method returns an associative array containing dst, offset and the timezone name. The timezone_abbreviations_list() function is an alias of this method.
Syntax
//Object-oriented style public DateTimeZone::listAbbreviations() //Procedural style timezone_abbreviations_list()
Parameters
No parameter is required.
Return Value
Returns an associative array containing dst, offset and the timezone name.
Example: using both styles
The example below shows the usage of DateTimeZone::listAbbreviations() method.
<?php //getting the abbreviation list using Object-oriented //style and displaying the result only for "amt" $retval1 = DateTimeZone::listAbbreviations(); print_r($retval1["amt"]); echo "\n--------------------------------\n\n"; //getting the abbreviation list using Procedural //style and displaying the result only for "acst" $retval2 = timezone_abbreviations_list(); print_r($retval2["acst"]); ?>
The output of the above code will be:
Array ( [0] => Array ( [dst] => [offset] => -13840 [timezone_id] => America/Asuncion ) [1] => Array ( [dst] => [offset] => 1172 [timezone_id] => Europe/Amsterdam ) [2] => Array ( [dst] => [offset] => 5692 [timezone_id] => Europe/Athens ) ) -------------------------------- Array ( [0] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Adelaide ) [1] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Broken_Hill ) [2] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Darwin ) [3] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/North ) [4] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/South ) [5] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Yancowinna ) )
❮ PHP Date and Time Reference