reference/datetime/datetimezone/gettransitions.xml
02ff7fef5b34cf8f5395180d9d39fb64d9398d00
...
...
@@ -1,6 +1,5 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-

4
3
<refentry xml:id="datetimezone.gettransitions" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5
4
<refnamediv>
6
5
<refname>DateTimeZone::getTransitions</refname>
...
...
@@ -10,17 +9,17 @@
10
9
<refsect1 role="description">
11
10
&reftitle.description;
12
11
<para>&style.oop;</para>
13
-
<methodsynopsis role="oop">
14
-
<modifier>public</modifier> <type>array</type><methodname>DateTimeZone::getTransitions</methodname>
15
-
<methodparam choice="opt"><type>int</type><parameter>timestamp_begin</parameter><initializer><constant>PHP_INT_MIN</constant></initializer></methodparam>
16
-
<methodparam choice="opt"><type>int</type><parameter>timestamp_end</parameter><initializer><constant>PHP_INT_MAX</constant></initializer></methodparam>
12
+
<methodsynopsis role="DateTimeZone">
13
+
<modifier>public</modifier> <type class="union"><type>array</type><type>false</type></type><methodname>DateTimeZone::getTransitions</methodname>
14
+
<methodparam choice="opt"><type>int</type><parameter>timestampBegin</parameter><initializer><constant>PHP_INT_MIN</constant></initializer></methodparam>
15
+
<methodparam choice="opt"><type>int</type><parameter>timestampEnd</parameter><initializer><constant>PHP_INT_MAX</constant></initializer></methodparam>
17
16
</methodsynopsis>
18
17
<para>&style.procedural;</para>
19
-
<methodsynopsis role="procedural">
20
-
<type>array</type><methodname>timezone_transitions_get</methodname>
18
+
<methodsynopsis>
19
+
<type class="union"><type>array</type><type>false</type></type><methodname>timezone_transitions_get</methodname>
21
20
<methodparam><type>DateTimeZone</type><parameter>object</parameter></methodparam>
22
-
<methodparam choice="opt"><type>int</type><parameter>timestamp_begin</parameter><initializer><constant>PHP_INT_MIN</constant></initializer></methodparam>
23
-
<methodparam choice="opt"><type>int</type><parameter>timestamp_end</parameter><initializer><constant>PHP_INT_MAX</constant></initializer></methodparam>
21
+
<methodparam choice="opt"><type>int</type><parameter>timestampBegin</parameter><initializer><constant>PHP_INT_MIN</constant></initializer></methodparam>
22
+
<methodparam choice="opt"><type>int</type><parameter>timestampEnd</parameter><initializer><constant>PHP_INT_MAX</constant></initializer></methodparam>
24
23
</methodsynopsis>
25
24
</refsect1>
26
25

...
...
@@ -30,7 +29,7 @@
30
29
<variablelist>
31
30
&date.datetimezone.description;
32
31
<varlistentry>
33
-
<term><parameter>timestamp_begin</parameter></term>
32
+
<term><parameter>timestampBegin</parameter></term>
34
33
<listitem>
35
34
<para>
36
35
Begin timestamp.
...
...
@@ -38,7 +37,7 @@
38
37
</listitem>
39
38
</varlistentry>
40
39
<varlistentry>
41
-
<term><parameter>timestamp_end</parameter></term>
40
+
<term><parameter>timestampEnd</parameter></term>
42
41
<listitem>
43
42
<para>
44
43
End timestamp.
...
...
@@ -52,33 +51,59 @@
52
51
<refsect1 role="returnvalues">
53
52
&reftitle.returnvalues;
54
53
<para>
55
-
Returns numerically indexed array containing associative array with all
56
-
transitions on success&return.falseforfailure;.
54
+
Returns a numerically indexed array of
55
+
transition arrays on success, &return.falseforfailure;. DateTimeZone
56
+
objects wrapping type 1 (UTC offsets) and type 2 (abbreviations) do not
57
+
contain any transitions, and calling this method on them will return
58
+
&false;.
57
59
</para>
58
-
</refsect1>
59
-

60
-
<refsect1 role="changelog">
61
-
&reftitle.changelog;
62
60
<para>
63
-
<informaltable>
61
+
If <parameter>timestampBegin</parameter> is given, the first entry in the
62
+
returned array will contain a transition element at the time of
63
+
<parameter>timestampBegin</parameter>.
64
+
</para>
65
+
<para>
66
+
<table>
67
+
<title>Transition Array Structure</title>
64
68
<tgroup cols="2">
65
69
<thead>
66
70
<row>
67
-
<entry>&Version;</entry>
68
-
<entry>&Description;</entry>
71
+
<entry>Key</entry>
72
+
<entry>Type</entry>
73
+
<entry>Description</entry>
69
74
</row>
70
75
</thead>
71
76
<tbody>
72
77
<row>
73
-
<entry>5.3.0</entry>
74
-
<entry>
75
-
The optional <parameter>timestamp_begin</parameter> and <parameter>timestamp_end</parameter>
76
-
were added.
77
-
</entry>
78
+
<entry><literal>ts</literal></entry>
79
+
<entry><type>int</type></entry>
80
+
<entry>Unix timestamp</entry>
81
+
</row>
82
+
<row>
83
+
<entry><literal>time</literal></entry>
84
+
<entry><type>string</type></entry>
85
+
<entry><constant>DateTimeInterface::ISO8601_EXPANDED</constant> (PHP
86
+
8.2 and later), or <constant>DateTimeInterface::ISO8601</constant> (PHP
87
+
8.1 and lower) time string</entry>
88
+
</row>
89
+
<row>
90
+
<entry><literal>offset</literal></entry>
91
+
<entry><type>int</type></entry>
92
+
<entry>Offset to UTC in seconds</entry>
93
+
</row>
94
+
<row>
95
+
<entry><literal>isdst</literal></entry>
96
+
<entry><type>bool</type></entry>
97
+
<entry>Whether daylight saving time is active</entry>
98
+
</row>
99
+
<row>
100
+
<entry><literal>abbr</literal></entry>
101
+
<entry><type>string</type></entry>
102
+
<entry>Timezone abbreviation</entry>
78
103
</row>
79
104
</tbody>
80
105
</tgroup>
81
-
</informaltable>
106
+
</table>
82
107
</para>
83
108
</refsect1>
84
109

...
...
@@ -132,11 +157,59 @@ Array
132
157
]]>
133
158
</screen>
134
159
</example>
160
+

161
+
<example>
162
+
<title>A <function>timezone_transitions_get</function> example with
163
+
<parameter>timestampBegin</parameter> set</title>
164
+
<programlisting role="php">
165
+
<![CDATA[
166
+
<?php
167
+
$timezone = new DateTimeZone("Europe/London");
168
+
$transitions = $timezone->getTransitions(time());
169
+
print_r(array_slice($transitions, 0, 3));
170
+
?>
171
+
]]>
172
+
</programlisting>
173
+
&example.outputs.similar;
174
+
<screen>
175
+
<![CDATA[
176
+
Array
177
+
(
178
+
[0] => Array
179
+
(
180
+
[ts] => 1654184161
181
+
[time] => 2022-06-02T15:36:01+0000
182
+
[offset] => 3600
183
+
[isdst] => 1
184
+
[abbr] => BST
185
+
)
186
+

187
+
[1] => Array
188
+
(
189
+
[ts] => 1667091600
190
+
[time] => 2022-10-30T01:00:00+0000
191
+
[offset] => 0
192
+
[isdst] =>
193
+
[abbr] => GMT
194
+
)
195
+

196
+
[2] => Array
197
+
(
198
+
[ts] => 1679792400
199
+
[time] => 2023-03-26T01:00:00+0000
200
+
[offset] => 3600
201
+
[isdst] => 1
202
+
[abbr] => BST
203
+
)
204
+

205
+
)
206
+
]]>
207
+
</screen>
208
+
</example>
135
209
</para>
136
210
</refsect1>
137
211

138
212
</refentry>
139
-

140
213
<!-- Keep this comment at the end of the file
141
214
Local variables:
142
215
mode: sgml
143
216