File: dateperiod.xml

package info (click to toggle)
php-doc 20241205~git.dfcbb86%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 70,956 kB
  • sloc: xml: 968,269; php: 23,883; javascript: 671; sh: 177; makefile: 37
file content (316 lines) | stat: -rw-r--r-- 10,062 bytes parent folder | download | duplicates (2)
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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<reference xml:id="class.dateperiod" role="class" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">

 <title>The DatePeriod class</title>
 <titleabbrev>DatePeriod</titleabbrev>

 <partintro>

<!-- {{{ DatePeriod intro -->
  <section xml:id="dateperiod.intro">
   &reftitle.intro;
   <para>
    Represents a date period.
   </para>
   <para>
    A date period allows iteration over a set of dates and times, recurring at
    regular intervals, over a given period.
   </para>
  </section>
<!-- }}} -->

  <section xml:id="dateperiod.synopsis">
   &reftitle.classsynopsis;

<!-- {{{ Synopsis -->
   <classsynopsis class="class">
    <ooclass>
     <classname>DatePeriod</classname>
    </ooclass>

    <oointerface>
     <modifier>implements</modifier>
     <interfacename>IteratorAggregate</interfacename>
    </oointerface>

    <classsynopsisinfo role="comment">&Constants;</classsynopsisinfo>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>const</modifier>
     <type>int</type>
     <varname linkend="dateperiod.constants.exclude-start-date">DatePeriod::EXCLUDE_START_DATE</varname>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>const</modifier>
     <type>int</type>
     <varname linkend="dateperiod.constants.include-end-date">DatePeriod::INCLUDE_END_DATE</varname>
    </fieldsynopsis>

    <classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>readonly</modifier>
     <type class="union"><type>DateTimeInterface</type><type>null</type></type>
     <varname linkend="dateperiod.props.start">start</varname>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>readonly</modifier>
     <type class="union"><type>DateTimeInterface</type><type>null</type></type>
     <varname linkend="dateperiod.props.current">current</varname>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>readonly</modifier>
     <type class="union"><type>DateTimeInterface</type><type>null</type></type>
     <varname linkend="dateperiod.props.end">end</varname>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>readonly</modifier>
     <type class="union"><type>DateInterval</type><type>null</type></type>
     <varname linkend="dateperiod.props.interval">interval</varname>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>readonly</modifier>
     <type>int</type>
     <varname linkend="dateperiod.props.recurrences">recurrences</varname>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>readonly</modifier>
     <type>bool</type>
     <varname linkend="dateperiod.props.include-start-date">include_start_date</varname>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>readonly</modifier>
     <type>bool</type>
     <varname linkend="dateperiod.props.include-end-date">include_end_date</varname>
    </fieldsynopsis>

    <classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
    <xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.dateperiod')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='DatePeriod'])">
     <xi:fallback/>
    </xi:include>
    <xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.dateperiod')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='DatePeriod'])">
     <xi:fallback/>
    </xi:include>
   </classsynopsis>
<!-- }}} -->

  </section>

<!-- {{{ DatePeriod constants -->
  <section xml:id="dateperiod.constants">
   &reftitle.constants;
   <variablelist>
    <varlistentry xml:id="dateperiod.constants.exclude-start-date">
     <term>
      <constant>DatePeriod::EXCLUDE_START_DATE</constant>
      <type>int</type>
     </term>
     <listitem>
      <para>Exclude start date, used in <function>DatePeriod::__construct</function>.</para>
     </listitem>
    </varlistentry>

    <varlistentry xml:id="dateperiod.constants.include-end-date">
     <term>
      <constant>DatePeriod::INCLUDE_END_DATE</constant>
      <type>int</type>
     </term>
     <listitem>
      <para>Include end date, used in <function>DatePeriod::__construct</function>.</para>
     </listitem>
    </varlistentry>

   </variablelist>
  </section>
<!-- }}} -->

  <section xml:id="dateperiod.props">
   &reftitle.properties;
   <variablelist>
    <varlistentry xml:id="dateperiod.props.recurrences">
     <term><varname>recurrences</varname></term>
     <listitem>
      <para>
       The minimum amount of instances as retured by the iterator.
      </para>
      <para>
       If the number of recurrences has been explicitly passed through the
       <varname>recurrences</varname> parameter in the constructor of the
       <classname>DatePeriod</classname> instance, then this property contains
       this value, <emphasis>plus</emphasis> one if the start date has not been disabled
       through <constant>DatePeriod::EXCLUDE_START_DATE</constant>,
       <emphasis>plus</emphasis> one if the end date has been enabled through
       <constant>DatePeriod::INCLUDE_END_DATE</constant>.
      </para>
      <para>
       If the number of recurrences has not been explicitly passed, then this
       property contains the minimum number of returned instances. This would
       be <literal>0</literal>, <emphasis>plus</emphasis> one if the start date
       has not been disabled through
       <constant>DatePeriod::EXCLUDE_START_DATE</constant>,
       <emphasis>plus</emphasis> one if the end date has been enabled through
       <constant>DatePeriod::INCLUDE_END_DATE</constant>.
      </para>
      <para>
       <informalexample>
        <programlisting role="php">
<![CDATA[<?php
$start = new DateTime('2018-12-31 00:00:00');
$end   = new DateTime('2021-12-31 00:00:00');
$interval = new DateInterval('P1M');
$recurrences = 5;

// recurrences explicitly set through the constructor
$period = new DatePeriod($start, $interval, $recurrences, DatePeriod::EXCLUDE_START_DATE);
echo $period->recurrences, "\n";

$period = new DatePeriod($start, $interval, $recurrences);
echo $period->recurrences, "\n";

$period = new DatePeriod($start, $interval, $recurrences, DatePeriod::INCLUDE_END_DATE);
echo $period->recurrences, "\n";

// recurrences not set in the constructor
$period = new DatePeriod($start, $interval, $end);
echo $period->recurrences, "\n";

$period = new DatePeriod($start, $interval, $end, DatePeriod::EXCLUDE_START_DATE);
echo $period->recurrences, "\n";
?>]]>
         </programlisting>
         &example.outputs;
         <screen role="php">
5
6
7
1
0
         </screen>
        </informalexample>
       </para>
      <para>
       See also <methodname>DatePeriod::getRecurrences</methodname>.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry xml:id="dateperiod.props.include-end-date">
     <term><varname>include_end_date</varname></term>
     <listitem>
      <para>
       Whether to include the end date in the set of recurring dates or not.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry xml:id="dateperiod.props.include-start-date">
     <term><varname>include_start_date</varname></term>
     <listitem>
      <para>
       Whether to include the start date in the set of recurring dates or not.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry xml:id="dateperiod.props.start">
     <term><varname>start</varname></term>
     <listitem>
      <para>
       The start date of the period.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry xml:id="dateperiod.props.current">
     <term><varname>current</varname></term>
     <listitem>
      <para>
       During iteration this will contain the current date within the period.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry xml:id="dateperiod.props.end">
     <term><varname>end</varname></term>
     <listitem>
      <para>
       The end date of the period.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry xml:id="dateperiod.props.interval">
     <term><varname>interval</varname></term>
     <listitem>
      <para>
       An ISO 8601 repeating interval specification.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </section>

  <section role="changelog">
   &reftitle.changelog;
   <informaltable>
    <tgroup cols="2">
     <thead>
      <row>
       <entry>&Version;</entry>
       <entry>&Description;</entry>
      </row>
     </thead>
     <tbody>
      <row>
       <entry>8.4.0</entry>
       <entry>
        The class constants are now typed.
       </entry>
      </row>
      <row>
       <entry>8.2.0</entry>
       <entry>
        The <constant>DatePeriod::INCLUDE_END_DATE</constant> constant and
        <property>include_end_date</property> property have been added.
       </entry>
      </row>
      <row>
       <entry>8.0.0</entry>
       <entry>
        <classname>DatePeriod</classname> implements
        <interfacename>IteratorAggregate</interfacename> now.
        Previously, <interfacename>Traversable</interfacename> was implemented instead.
       </entry>
      </row>
     </tbody>
    </tgroup>
   </informaltable>
  </section>

 </partintro>

 &reference.datetime.entities.dateperiod;

</reference>
<!-- 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
-->