2020 <methodparam choice =" opt" ><type >int</type ><parameter >timezoneGroup</parameter ><initializer >DateTimeZone::ALL</initializer ></methodparam >
2121 <methodparam choice =" opt" ><type class =" union" ><type >string</type ><type >null</type ></type ><parameter >countryCode</parameter ><initializer >&null; </initializer ></methodparam >
2222 </methodsynopsis >
23+ <simpara >
24+ Return the list of <link xlink : href =" &url.wiki.tzdb.names; " >IANA Time Zone identifiers</link >.
25+ </simpara >
26+
27+ <note >
28+ <simpara >
29+ It's possible to detect the client (browser) timezone with JavaScript using
30+ <link xlink : href =" &url.js.intl-datetimeformat; " >Intl.DateTimeFormat</link > or
31+ <link xlink : href =" &url.js.temporal-zoneddatetime; " >Temporal.ZonedDateTime</link >.
32+ </simpara >
33+ </note >
34+
2335 </refsect1 >
2436
2537 <refsect1 role =" parameters" >
96108 &reftitle.examples;
97109 <para >
98110 <example >
99- <title >A < methodname >DateTimeZone::listIdentifiers</ methodname > example </title >
111+ <title >List identifiers with location comments </title >
100112 <programlisting role =" php" >
101113<![CDATA[
102114<?php
103- $timezone_identifiers = DateTimeZone::listIdentifiers();
104- for ($i=0; $i < 5; $i++) {
105- echo "$timezone_identifiers[$i]\n";
115+ $identifiers = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
116+
117+ foreach ($identifiers as $tzid) {
118+ $tz = new DateTimeZone($tzid);
119+ $comments = $tz->getLocation()['comments'];
120+ echo $tzid . " (" . ($comments ?: 'Whole region') . ")\n";
106121}
107- ?>
108122]]>
109123 </programlisting >
110124 &example.outputs.similar;
111125 <screen >
112126<![CDATA[
113- Africa/Abidjan
114- Africa/Accra
115- Africa/Addis_Ababa
116- Africa/Algiers
117- Africa/Asmara
127+ America/Antigua (Whole region)
128+ America/Araguaina (Tocantins)
129+ America/Argentina/Buenos_Aires (Buenos Aires (BA, CF))
130+ America/Argentina/Catamarca (Catamarca (CT), Chubut (CH))
131+ America/Argentina/Cordoba (Argentina (most areas: CB, CC, CN, ER, FM, MN, SE, SF))
132+ // (Output trimmed due to length)
118133]]>
119134 </screen >
120135 </example >
@@ -130,7 +145,6 @@ $timezone_identifiers = DateTimeZone::listIdentifiers( DateTimeZone::ASIA );
130145for ($i=0; $i < 5; $i++) {
131146 echo "$timezone_identifiers[$i]\n";
132147}
133- ?>
134148]]>
135149 </programlisting >
136150 &example.outputs.similar;
@@ -154,7 +168,6 @@ Asia/Aqtau
154168<?php
155169$timezone_identifiers = DateTimeZone::listIdentifiers( DateTimeZone::ASIA | DateTimeZone::PACIFIC );
156170echo join( ', ', $timezone_identifiers );
157- ?>
158171]]>
159172 </programlisting >
160173 &example.outputs.similar;
@@ -201,7 +214,6 @@ $timezone_identifiers = DateTimeZone::listIdentifiers( DateTimeZone::PER_COUNTRY
201214foreach( $timezone_identifiers as $identifier ) {
202215 echo "$identifier\n";
203216}
204- ?>
205217]]>
206218 </programlisting >
207219 &example.outputs.similar;
0 commit comments