Tutorialspoint.dev

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:

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

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:

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

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



This article is attributed to GeeksforGeeks.org

You Might Also Like

leave a comment

code

0 Comments

load comments

Subscribe to Our Newsletter