PHP timezone_identifiers_list() 函数

PHP timezone_identifiers_list() 函数

返回 PHP Date/Time 参考手册


实例

输出非洲的所有时区:

<?php
print_r(timezone_identifiers_list(1));
?>

执行结果

Array
(
    [0] => Africa/Abidjan
    [1] => Africa/Accra
    [2] => Africa/Addis_Ababa
    [3] => Africa/Algiers
    [4] => Africa/Asmara
    [5] => Africa/Bamako
    [6] => Africa/Bangui
    [7] => Africa/Banjul
    [8] => Africa/Bissau
    [9] => Africa/Blantyre
    [10] => Africa/Brazzaville
    [11] => Africa/Bujumbura
    [12] => Africa/Cairo
    [13] => Africa/Casablanca
    [14] => Africa/Ceuta
    [15] => Africa/Conakry
    [16] => Africa/Dakar
    [17] => Africa/Dar_es_Salaam
    [18] => Africa/Djibouti
    [19] => Africa/Douala
    [20] => Africa/El_Aaiun
    [21] => Africa/Freetown
    [22] => Africa/Gaborone
    [23] => Africa/Harare
    [24] => Africa/Johannesburg
    [25] => Africa/Juba
    [26] => Africa/Kampala
    [27] => Africa/Khartoum
    [28] => Africa/Kigali
    [29] => Africa/Kinshasa
    [30] => Africa/Lagos
    [31] => Africa/Libreville
    [32] => Africa/Lome
    [33] => Africa/Luanda
    [34] => Africa/Lubumbashi
    [35] => Africa/Lusaka
    [36] => Africa/Malabo
    [37] => Africa/Maputo
    [38] => Africa/Maseru
    [39] => Africa/Mbabane
    [40] => Africa/Mogadishu
    [41] => Africa/Monrovia
    [42] => Africa/Nairobi
    [43] => Africa/Ndjamena
    [44] => Africa/Niamey
    [45] => Africa/Nouakchott
    [46] => Africa/Ouagadougou
    [47] => Africa/Porto-Novo
    [48] => Africa/Sao_Tome
    [49] => Africa/Tripoli
    [50] => Africa/Tunis
    [51] => Africa/Windhoek
)

定义和用法

timezone_identifiers_list() 返回带有所有时区标识符的数值数组。

语法

timezone_identifiers_list(what,country);
参数 描述
what 可选。规定一个 DateTimeZone 类常量
1 = AFRICA
2 = AMERICA
4 = ANTARCTICA
8 = ARCTIC
16 = ASIA
32 = ATLANTIC
64 = AUSTRALIA
128 = EUROPE
256 = INDIAN
512 = PACIFIC
1024 = UTC
2047 = ALL
4095 = ALL_WITH_BC
4096 = PER_COUNTRY
country 可选。规定两个字母的 ISO 3166-1 兼容的国家代码。

技术细节

  • 返回值: 成功则返回一个数值数组,失败则返回 FALSE。
  • PHP 版本: 5.2+
  • 更新日志: PHP 5.3:新增可选的 what 和 country 参数。

返回 PHP Date/Time 参考手册

查看笔记

扫码一下
查看教程更方便