reference/datetime/dateinterval.xml
9154789dfc9cb8aa5df644bfba5e86c2deba4cb8
...
...
@@ -16,7 +16,8 @@
16
16
<para>
17
17
A date interval stores either a fixed amount of time (in years, months,
18
18
days, hours etc) or a relative time string in the format that
19
-
<classname>DateTime</classname>'s constructor supports.
19
+
<classname>DateTimeImmutable</classname>'s and
20
+
<classname>DateTime</classname>'s constructors support.
20
21
</para>
21
22
<para>
22
23
More specifically, the information in an object of the
...
...
@@ -26,7 +27,7 @@
26
27
<para>
27
28
A common way to create a <classname>DateInterval</classname> object
28
29
is by calculating the difference between two date/time objects through
29
-
<function>DateTimeInterface::diff</function>.
30
+
<methodname>DateTimeInterface::diff</methodname>.
30
31
</para>
31
32
<para>
32
33
Since there is no well defined way to compare date intervals,
...
...
@@ -40,17 +41,11 @@
40
41
&reftitle.classsynopsis;
41
42

42
43
<!-- {{{ Synopsis -->
43
-
<classsynopsis>
44
+
<classsynopsis class="class">
44
45
<ooclass>
45
46
<classname>DateInterval</classname>
46
47
</ooclass>
47
48

48
-
<classsynopsisinfo>
49
-
<ooclass>
50
-
<classname>DateInterval</classname>
51
-
</ooclass>
52
-
</classsynopsisinfo>
53
-

54
49
<classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
55
50
<fieldsynopsis>
56
51
<modifier>public</modifier>
...
...
@@ -97,12 +92,22 @@
97
92
<type>mixed</type>
98
93
<varname linkend="dateinterval.props.days">days</varname>
99
94
</fieldsynopsis>
95
+
<fieldsynopsis>
96
+
<modifier>public</modifier>
97
+
<type>bool</type>
98
+
<varname linkend="dateinterval.props.from-string">from_string</varname>
99
+
</fieldsynopsis>
100
+
<fieldsynopsis>
101
+
<modifier>public</modifier>
102
+
<type>string</type>
103
+
<varname linkend="dateinterval.props.date-string">date_string</varname>
104
+
</fieldsynopsis>
100
105
101
106
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
102
-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.dateinterval')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[not(@role='procedural')])">
107
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.dateinterval')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='DateInterval'])">
103
108
<xi:fallback/>
104
109
</xi:include>
105
-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.dateinterval')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[not(@role='procedural')])">
110
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.dateinterval')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='DateInterval'])">
106
111
<xi:fallback/>
107
112
</xi:include>
108
113
</classsynopsis>
...
...
@@ -112,6 +117,12 @@
112
117
113
118
<section xml:id="dateinterval.props">
114
119
&reftitle.properties;
120
+
<warning>
121
+
<para>
122
+
The available properties listed below depend on PHP version, and should
123
+
be considered as <emphasis>readonly</emphasis>.
124
+
</para>
125
+
</warning>
115
126
<variablelist>
116
127
<varlistentry xml:id="dateinterval.props.y">
117
128
<term><varname>y</varname></term>
...
...
@@ -185,12 +196,36 @@
185
196
<listitem>
186
197
<para>
187
198
If the DateInterval object was created by
188
-
<function>DateTime::diff</function>, then this is the total number of
189
-
days between the start and end dates. Otherwise,
199
+
<methodname>DateTimeImmutable::diff</methodname> or
200
+
<methodname>DateTime::diff</methodname>, then this is the
201
+
total number of full days between the start and end dates. Otherwise,
190
202
<varname>days</varname> will be &false;.
191
203
</para>
192
204
</listitem>
193
205
</varlistentry>
206
+
<varlistentry xml:id="dateinterval.props.from-string">
207
+
<term><varname>from_string</varname></term>
208
+
<listitem>
209
+
<para>
210
+
If the DateInterval object was created by
211
+
<methodname>DateInterval::createFromDateString</methodname>, then
212
+
this property's value will be &true;, and the
213
+
<varname>date_string</varname> property will be populated. Otherwise,
214
+
the value will be &false;, and the <varname>y</varname> to
215
+
<varname>f</varname>, <varname>invert</varname>, and
216
+
<varname>days</varname> properties will be populated.
217
+
</para>
218
+
</listitem>
219
+
</varlistentry>
220
+
<varlistentry xml:id="dateinterval.props.date-string">
221
+
<term><varname>date_string</varname></term>
222
+
<listitem>
223
+
<para>
224
+
The string used as argument to
225
+
<methodname>DateInterval::createFromDateString</methodname>.
226
+
</para>
227
+
</listitem>
228
+
</varlistentry>
194
229
</variablelist>
195
230
</section>
196
231

...
...
@@ -206,13 +241,29 @@
206
241
</row>
207
242
</thead>
208
243
<tbody>
209
-
<row>
210
-
<entry>7.4.0</entry>
211
-
<entry>
212
-
<classname>DateInterval</classname> instances are incomparable now;
213
-
previously, all <classname>DateInterval</classname> instances were considered equal.
214
-
</entry>
215
-
</row>
244
+
<row>
245
+
<entry>8.2.0</entry>
246
+
<entry>
247
+
The <varname>from_string</varname> and <varname>date_string</varname>
248
+
properties were added for <classname>DateInterval</classname>
249
+
instances that were created using the
250
+
<methodname>DateInterval::createFromDateString</methodname> method.
251
+
</entry>
252
+
</row>
253
+
<row>
254
+
<entry>8.2.0</entry>
255
+
<entry>
256
+
Only the <literal>y</literal> to <literal>f</literal>,
257
+
<literal>invert</literal>, and <literal>days</literal> will be visible.
258
+
</entry>
259
+
</row>
260
+
<row>
261
+
<entry>7.4.0</entry>
262
+
<entry>
263
+
<classname>DateInterval</classname> instances are incomparable now;
264
+
previously, all <classname>DateInterval</classname> instances were considered equal.
265
+
</entry>
266
+
</row>
216
267
<row>
217
268
<entry>7.1.0</entry>
218
269
<entry>The <varname>f</varname> property was added.</entry>
219
270