-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathlistidentifiers.xml
More file actions
263 lines (249 loc) · 9.34 KB
/
listidentifiers.xml
File metadata and controls
263 lines (249 loc) · 9.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: c142be811735a5542c8a2e4c4ed2f81e8cc3acc6 Maintainer: das Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="datetimezone.listidentifiers" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>DateTimeZone::listIdentifiers</refname>
<refname>timezone_identifiers_list</refname>
<refpurpose>Возвращает индексный массив идентификаторов часовых поясов</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>&style.oop;</para>
<methodsynopsis role="DateTimeZone">
<modifier>public</modifier> <modifier>static</modifier> <type>array</type><methodname>DateTimeZone::listIdentifiers</methodname>
<methodparam choice="opt"><type>int</type><parameter>timezoneGroup</parameter><initializer><constant>DateTimeZone::ALL</constant></initializer></methodparam>
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>countryCode</parameter><initializer>&null;</initializer></methodparam>
</methodsynopsis>
<para>&style.procedural;</para>
<methodsynopsis>
<type>array</type><methodname>timezone_identifiers_list</methodname>
<methodparam choice="opt"><type>int</type><parameter>timezoneGroup</parameter><initializer><constant>DateTimeZone::ALL</constant></initializer></methodparam>
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>countryCode</parameter><initializer>&null;</initializer></methodparam>
</methodsynopsis>
<simpara>
Метод возвращает список <link xlink:href="&url.wiki.tzdb.names;">идентификаторов часовых поясов</link>, которые определила администрация IANA.
</simpara>
<note>
<simpara>
Для определения часового пояса клиента, например браузера, в JavaScript обращаются к объекту
<link xlink:href="&url.js.intl-datetimeformat;">Intl.DateTimeFormat</link>
или <link xlink:href="&url.js.temporal-zoneddatetime;">Temporal.ZonedDateTime</link>.
</simpara>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>timezoneGroup</parameter></term>
<listitem>
<para>
Константа или комбинация констант класса <classname>DateTimeZone</classname>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>countryCode</parameter></term>
<listitem>
<para>
Двухбуквенный код страны в верхнем регистре, совместимый со стандартом ISO 3166-1.
</para>
<note>
<simpara>
Параметр требуется и влияет на результат только при установке для параметра <parameter>timezoneGroup</parameter>
флага <constant>DateTimeZone::PER_COUNTRY</constant>.
</simpara>
</note>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Метод возвращает массив идентификаторов часовых поясов. Возвращаются только неустаревшие элементы.
При передаче в параметр <parameter>timezoneGroup</parameter> флага <literal>DateTimeZone::ALL_WITH_BC</literal>
метод возвращает все идентификаторы часовых поясов, включая устаревшие.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.0.0</entry>
<entry>
До этой версии при ошибке возвращалось значение &false;.
</entry>
</row>
<row>
<entry>7.1.0</entry>
<entry>
Параметр <parameter>countryCode</parameter> теперь принимает значение &null;.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Пример получения списка идентификаторов часовых поясов с комментарием о расположении</title>
<programlisting role="php">
<![CDATA[
<?php
$identifiers = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
foreach ($identifiers as $tzid) {
$tz = new DateTimeZone($tzid);
$comments = $tz->getLocation()['comments'];
echo $tzid . " (" . ($comments ?: 'Whole region') . ")\n";
}
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
America/Antigua (Whole region)
America/Araguaina (Tocantins)
America/Argentina/Buenos_Aires (Buenos Aires (BA, CF))
America/Argentina/Catamarca (Catamarca (CT), Chubut (CH))
America/Argentina/Cordoba (Argentina (most areas: CB, CC, CN, ER, FM, MN, SE, SF))
// (Только фрагмент вывода, из-за длины)
]]>
</screen>
</example>
</para>
<para>
<example>
<title>Пример получения списка идентификаторов конкретного региона</title>
<programlisting role="php">
<![CDATA[
<?php
$timezone_identifiers = DateTimeZone::listIdentifiers(DateTimeZone::ASIA);
for ($i = 0; $i < 5; $i++) {
echo "$timezone_identifiers[$i]\n";
}
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Asia/Aden
Asia/Almaty
Asia/Amman
Asia/Anadyr
Asia/Aqtau
]]>
</screen>
</example>
</para>
<para>
<example>
<title>Пример получения списка идентификаторов двух регионов</title>
<programlisting role="php">
<![CDATA[
<?php
$timezone_identifiers = DateTimeZone::listIdentifiers(DateTimeZone::ASIA | DateTimeZone::PACIFIC);
echo join(', ', $timezone_identifiers);
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Asia/Aden, Asia/Almaty, Asia/Amman, Asia/Anadyr, Asia/Aqtau, Asia/Aqtobe,
Asia/Ashgabat, Asia/Atyrau, Asia/Baghdad, Asia/Bahrain, Asia/Baku,
Asia/Bangkok, Asia/Barnaul, Asia/Beirut, Asia/Bishkek, Asia/Brunei,
Asia/Chita, Asia/Choibalsan, Asia/Colombo, Asia/Damascus, Asia/Dhaka,
Asia/Dili, Asia/Dubai, Asia/Dushanbe, Asia/Famagusta, Asia/Gaza, Asia/Hebron,
Asia/Ho_Chi_Minh, Asia/Hong_Kong, Asia/Hovd, Asia/Irkutsk, Asia/Jakarta,
Asia/Jayapura, Asia/Jerusalem, Asia/Kabul, Asia/Kamchatka, Asia/Karachi,
Asia/Kathmandu, Asia/Khandyga, Asia/Kolkata, Asia/Krasnoyarsk,
Asia/Kuala_Lumpur, Asia/Kuching, Asia/Kuwait, Asia/Macau, Asia/Magadan,
Asia/Makassar, Asia/Manila, Asia/Muscat, Asia/Nicosia, Asia/Novokuznetsk,
Asia/Novosibirsk, Asia/Omsk, Asia/Oral, Asia/Phnom_Penh, Asia/Pontianak,
Asia/Pyongyang, Asia/Qatar, Asia/Qostanay, Asia/Qyzylorda, Asia/Riyadh,
Asia/Sakhalin, Asia/Samarkand, Asia/Seoul, Asia/Shanghai, Asia/Singapore,
Asia/Srednekolymsk, Asia/Taipei, Asia/Tashkent, Asia/Tbilisi, Asia/Tehran,
Asia/Thimphu, Asia/Tokyo, Asia/Tomsk, Asia/Ulaanbaatar, Asia/Urumqi,
Asia/Ust-Nera, Asia/Vientiane, Asia/Vladivostok, Asia/Yakutsk, Asia/Yangon,
Asia/Yekaterinburg, Asia/Yerevan, Pacific/Apia, Pacific/Auckland,
Pacific/Bougainville, Pacific/Chatham, Pacific/Chuuk, Pacific/Easter,
Pacific/Efate, Pacific/Fakaofo, Pacific/Fiji, Pacific/Funafuti,
Pacific/Galapagos, Pacific/Gambier, Pacific/Guadalcanal, Pacific/Guam,
Pacific/Honolulu, Pacific/Kanton, Pacific/Kiritimati, Pacific/Kosrae,
Pacific/Kwajalein, Pacific/Majuro, Pacific/Marquesas, Pacific/Midway,
Pacific/Nauru, Pacific/Niue, Pacific/Norfolk, Pacific/Noumea,
Pacific/Pago_Pago, Pacific/Palau, Pacific/Pitcairn, Pacific/Pohnpei,
Pacific/Port_Moresby, Pacific/Rarotonga, Pacific/Saipan, Pacific/Tahiti,
Pacific/Tarawa, Pacific/Tongatapu, Pacific/Wake, Pacific/Wallis
]]>
</screen>
</example>
</para>
<para>
<example>
<title>Пример получения списка идентификаторов одной страны</title>
<programlisting role="php">
<![CDATA[
<?php
$timezone_identifiers = DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, "UA");
foreach ($timezone_identifiers as $identifier) {
echo "$identifier\n";
}
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Europe/Kyiv
Europe/Simferopol
Europe/Uzhgorod
Europe/Zaporozhye
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>timezone_abbreviations_list</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->