11<?xml version =" 1.0" encoding =" utf-8" ?>
22<!-- $Revision$ -->
3- <!-- EN-Revision: 02ff7fef5b34cf8f5395180d9d39fb64d9398d00 Maintainer: takagi Status: ready -->
4- <!-- Credits: mumumu -->
5-
3+ <!-- EN-Revision: c018a4d2c85ac429f238f78679eca46d86c63a31Maintainer: mumumu Status: ready -->
64<refentry xml : id =" datetimezone.listidentifiers" xmlns =" http://docbook.org/ns/docbook" xmlns : xlink =" http://www.w3.org/1999/xlink" >
75 <refnamediv >
86 <refname >DateTimeZone::listIdentifiers</refname >
2321 <methodparam choice =" opt" ><type >int</type ><parameter >timezoneGroup</parameter ><initializer >DateTimeZone::ALL</initializer ></methodparam >
2422 <methodparam choice =" opt" ><type class =" union" ><type >string</type ><type >null</type ></type ><parameter >countryCode</parameter ><initializer >&null; </initializer ></methodparam >
2523 </methodsynopsis >
24+ <simpara >
25+ <link xlink : href =" &url.wiki.tzdb.names; " >IANA Time Zone identifiers</link > の一覧を返します。
26+ </simpara >
27+
28+ <note >
29+ <simpara >
30+ <link xlink : href =" &url.js.intl-datetimeformat; " >Intl.DateTimeFormat</link >
31+ や
32+ <link xlink : href =" &url.js.temporal-zoneddatetime; " >Temporal.ZonedDateTime</link >
33+ を使うと、
34+ JavaScript でクライアント(ブラウザ) のタイムゾーンを検知することができます。
35+ </simpara >
36+ </note >
37+
2638 </refsect1 >
2739
2840 <refsect1 role =" parameters" >
6577 <literal >DateTimeZone::ALL_WITH_BC</literal > を指定します。
6678 </para >
6779 </refsect1 >
68-
80+
6981 <refsect1 role =" changelog" >
7082 &reftitle.changelog;
7183 <para >
100112 &reftitle.examples;
101113 <para >
102114 <example >
103- <title >< methodname >DateTimeZone::listIdentifiers</ methodname > の例 </title >
115+ <title >地域のコメントを付けて、識別子の一覧を取得する </title >
104116 <programlisting role =" php" >
105117<![CDATA[
106118<?php
107- $timezone_identifiers = DateTimeZone::listIdentifiers();
108- for ($i=0; $i < 5; $i++) {
109- echo "$timezone_identifiers[$i]\n";
119+ $identifiers = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
120+
121+ foreach ($identifiers as $tzid) {
122+ $tz = new DateTimeZone($tzid);
123+ $comments = $tz->getLocation()['comments'];
124+ echo $tzid . " (" . ($comments ?: 'Whole region') . ")\n";
110125}
111- ?>
112126]]>
113127 </programlisting >
114128 &example.outputs.similar;
115129 <screen >
116130<![CDATA[
117- Africa/Abidjan
118- Africa/Accra
119- Africa/Addis_Ababa
120- Africa/Algiers
121- Africa/Asmara
131+ America/Antigua (Whole region)
132+ America/Araguaina (Tocantins)
133+ America/Argentina/Buenos_Aires (Buenos Aires (BA, CF))
134+ America/Argentina/Catamarca (Catamarca (CT), Chubut (CH))
135+ America/Argentina/Cordoba (Argentina (most areas: CB, CC, CN, ER, FM, MN, SE, SF))
136+ // (Output trimmed due to length)
122137]]>
123138 </screen >
124139 </example >
@@ -134,7 +149,6 @@ $timezone_identifiers = DateTimeZone::listIdentifiers( DateTimeZone::ASIA );
134149for ($i=0; $i < 5; $i++) {
135150 echo "$timezone_identifiers[$i]\n";
136151}
137- ?>
138152]]>
139153 </programlisting >
140154 &example.outputs.similar;
@@ -158,7 +172,6 @@ Asia/Aqtau
158172<?php
159173$timezone_identifiers = DateTimeZone::listIdentifiers( DateTimeZone::ASIA | DateTimeZone::PACIFIC );
160174echo join( ', ', $timezone_identifiers );
161- ?>
162175]]>
163176 </programlisting >
164177 &example.outputs.similar;
@@ -205,7 +218,6 @@ $timezone_identifiers = DateTimeZone::listIdentifiers( DateTimeZone::PER_COUNTRY
205218foreach( $timezone_identifiers as $identifier ) {
206219 echo "$identifier\n";
207220}
208- ?>
209221]]>
210222 </programlisting >
211223 &example.outputs.similar;
0 commit comments