DateTimeZone
PHP 手册

DateTimeZone::listIdentifiers

(PHP 5 >= 5.3.0)

DateTimeZone::listIdentifiersReturns numerically index array with all timezone identifiers

说明

array DateTimeZone::listIdentifiers ([ int $what=DateTime::ALL [, string $country=NULL ]] )
array timezone_identifiers_list ([ int $what=DateTime::ALL [, string $country=NULL ]] )

参数

object

Procedural style only: A DateTime object returned by date_create()

what

One of DateTimeZone class constants, defaults to DateTimeZone::ALL.

country

A two-letter ISO 3166-1 compatible country code.

返回值

Returns array on success or FALSE on failure.

范例

Example #1 A timezone_identifiers_list() example

<?php
$timezone_identifiers 
DateTimeZone::listIdentifiers();
for (
$i=0$i 5$i++) {
    echo 
"$timezone_identifiers[$i]\n";
}
?>

上例的输出类似于:

Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmera

参见


DateTimeZone
PHP 手册