PHP | timezone_abbreviations_list() Function

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
  
// Printing dst, offset, and timezone
// name for the "acst" timezone
$timezone_list = timezone_abbreviations_list();
print_r($timezone_list["acst"]);
?>

chevron_right


Output:

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
  
// Printing dst, offset, and timezone name 
// for the "acst" timezone
$timezone_abbreviations = DateTimeZone::listAbbreviations();
print_r($timezone_abbreviations["acst"]);
?>

chevron_right


Output:

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:

Reference: http://php.net/manual/en/function.timezone-abbreviations-list.php



My Personal Notes arrow_drop_up

I am a technology enthusiast who has a keen interest in programming I am pursuing Engineering in Computer Science from GEU, Dehradun I like to unwind by watching movies and English sitcomsI have a keen interest in music

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.