La función timezone_abbreviations_list() es una función incorporada en PHP que se usa para devolver una array asociativa que contiene dst, offset y el nombre de la zona horaria. No se requieren parámetros para enviar a la función timezone_abbreviations_list() y devuelve una array asociativa en caso de éxito o False en caso de falla.
Sintaxis:
array timezone_abbreviations_list()
Parámetros: La función timezone_abbreviations_list() no requiere ningún parámetro.
Valor devuelto: esta función devuelve una array asociativa que contiene dst, offset y el nombre de la zona horaria.
Excepciones: La función timezone_identifiers_list() es un alias de la función DateTimeZone::listAbbreviations().
El siguiente programa ilustra la función timezone_abbreviations_list() en PHP:
Programa 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 ) )
Programa 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 ) )
Artículos relacionados:
- PHP | función timezone_name_from_abbr()
- PHP | función timezone_location_get()
- PHP | función timezone_offset_get()
Referencia: http://php.net/manual/en/function.timezone-abbreviations-list.php
Publicación traducida automáticamente
Artículo escrito por Shubrodeep Banerjee y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA