The timezone_abbreviations_list() function is an inbuilt function in PHP which is used to return an associative array containing dst, offset, and the timezone name. No parameters are required to send to the timezone_abbreviations_list() function and it returns an associative array on success or False on failure.
Syntax:
array timezone_abbreviations_list()
Parameters: The timezone_abbreviations_list() function does not require any parameters.
Return Value: This function returns an associative array containing dst, offset, and the timezone name.
Exceptions: The timezone_identifiers_list() function is an alias of DateTimeZone::listAbbreviations() function.
Below program illustrate the timezone_abbreviations_list() function in PHP:
Program 1:
<?php // Printing dst, offset, and timezone // name for the "acst" timezone $timezone_list = timezone_abbreviations_list(); print_r( $timezone_list [ "acst" ]); ?> |
Array ( [0] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/Adelaide ) [1] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Adelaide ) [2] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/Broken_Hill ) [3] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/Darwin ) [4] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/North ) [5] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/South ) [6] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/Yancowinna ) [7] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Broken_Hill ) [8] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Darwin ) [9] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/North ) [10] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/South ) [11] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Yancowinna ) )
Program 2:
<?php // Printing dst, offset, and timezone name // for the "acst" timezone $timezone_abbreviations = DateTimeZone::listAbbreviations(); print_r( $timezone_abbreviations [ "acst" ]); ?> |
Array ( [0] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/Adelaide ) [1] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Adelaide ) [2] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/Broken_Hill ) [3] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/Darwin ) [4] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/North ) [5] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/South ) [6] => Array ( [dst] => [offset] => 32400 [timezone_id] => Australia/Yancowinna ) [7] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Broken_Hill ) [8] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Darwin ) [9] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/North ) [10] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/South ) [11] => Array ( [dst] => [offset] => 34200 [timezone_id] => Australia/Yancowinna ) )
Related Articles:
- PHP | timezone_name_from_abbr() Function
- PHP | timezone_location_get() Function
- PHP | timezone_offset_get() Function
Reference: http://php.net/manual/en/function.timezone-abbreviations-list.php