timezone_abbreviations_list()函數是PHP中的內置函數,用於返回包含dst,offset和時區名稱的關聯數組。不需要參數即可發送到timezone_abbreviations_list()函數,並且成功時返回關聯數組,失敗時返回False。
用法:
array timezone_abbreviations_list()
參數:timezone_abbreviations_list()函數不需要任何參數。
返回值:此函數返回一個包含dst,offset和時區名稱的關聯數組。
異常:timezone_identifiers_list()函數是DateTimeZone::listAbbreviations()函數的別名。
以下示例程序旨在說明PHP中的timezone_abbreviations_list()函數:
程序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 ) )
程序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 ) )
相關文章:
- PHP | timezone_name_from_abbr()函數
- PHP | timezone_location_get()函數
- PHP - timezone_offset_get()用法及代碼示例
參考: http://php.net/manual/en/function.timezone-abbreviations-list.php
相關用法
- PHP exp()用法及代碼示例
- d3.js d3.lab()用法及代碼示例
- PHP Ds\Map put()用法及代碼示例
- d3.js d3.hcl()用法及代碼示例
- PHP sin( )用法及代碼示例
- PHP abs()用法及代碼示例
- PHP Ds\Set xor()用法及代碼示例
- PHP cos( )用法及代碼示例
- PHP tan( )用法及代碼示例
- d3.js d3.map.set()用法及代碼示例
- PHP next()用法及代碼示例
- PHP Ds\Map get()用法及代碼示例
注:本文由純淨天空篩選整理自Shubrodeep Banerjee大神的英文原創作品 PHP | timezone_abbreviations_list() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。