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

4
3
<refentry xml:id="datetime.setisodate" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5
4
<refnamediv>
6
5
<refname>DateTime::setISODate</refname>
...
...
@@ -11,24 +10,32 @@
11
10
<refsect1 role="description">
12
11
&reftitle.description;
13
12
<para>&style.oop;</para>
14
-
<methodsynopsis role="oop">
13
+
<methodsynopsis role="DateTime">
15
14
<modifier>public</modifier> <type>DateTime</type><methodname>DateTime::setISODate</methodname>
16
15
<methodparam><type>int</type><parameter>year</parameter></methodparam>
17
16
<methodparam><type>int</type><parameter>week</parameter></methodparam>
18
-
<methodparam choice="opt"><type>int</type><parameter>day</parameter><initializer>1</initializer></methodparam>
17
+
<methodparam choice="opt"><type>int</type><parameter>dayOfWeek</parameter><initializer>1</initializer></methodparam>
19
18
</methodsynopsis>
20
19
<para>&style.procedural;</para>
21
-
<methodsynopsis role="procedural">
20
+
<methodsynopsis>
22
21
<type>DateTime</type><methodname>date_isodate_set</methodname>
23
22
<methodparam><type>DateTime</type><parameter>object</parameter></methodparam>
24
23
<methodparam><type>int</type><parameter>year</parameter></methodparam>
25
24
<methodparam><type>int</type><parameter>week</parameter></methodparam>
26
-
<methodparam choice="opt"><type>int</type><parameter>day</parameter><initializer>1</initializer></methodparam>
25
+
<methodparam choice="opt"><type>int</type><parameter>dayOfWeek</parameter><initializer>1</initializer></methodparam>
27
26
</methodsynopsis>
28
27
<para>
29
28
Set a date according to the ISO 8601 standard - using weeks and day offsets
30
29
rather than specific dates.
31
30
</para>
31
+
<para>
32
+
Like <methodname>DateTimeImmutable::setISODate</methodname> but works with
33
+
<classname>DateTime</classname>.
34
+
</para>
35
+
<para>
36
+
The procedural version takes the <classname>DateTime</classname> object as
37
+
its first argument.
38
+
</para>
32
39
</refsect1>
33
40

34
41
<refsect1 role="parameters">
...
...
@@ -52,7 +59,7 @@
52
59
</listitem>
53
60
</varlistentry>
54
61
<varlistentry>
55
-
<term><parameter>day</parameter></term>
62
+
<term><parameter>dayOfWeek</parameter></term>
56
63
<listitem>
57
64
<para>
58
65
Offset from the first day of the week.
...
...
@@ -65,124 +72,18 @@
65
72
<refsect1 role="returnvalues">
66
73
&reftitle.returnvalues;
67
74
<para>
68
-
&date.datetime.return.modifiedobjectorfalseforfailure;
75
+
&date.datetime.return.modifiedobject;
69
76
</para>
70
77
</refsect1>
71
78

72
-
<refsect1 role="changelog">
73
-
&reftitle.changelog;
74
-
<informaltable>
75
-
<tgroup cols="2">
76
-
<thead>
77
-
<row>
78
-
<entry>&Version;</entry>
79
-
<entry>&Description;</entry>
80
-
</row>
81
-
</thead>
82
-
<tbody>
83
-
&date.datetime.retval.changelog;
84
-
</tbody>
85
-
</tgroup>
86
-
</informaltable>
87
-
</refsect1>
88
-

89
-
<refsect1 role="examples">
90
-
&reftitle.examples;
91
-
<example>
92
-
<title><function>DateTime::setISODate</function> example</title>
93
-
<para>&style.oop;</para>
94
-
<programlisting role="php">
95
-
<![CDATA[
96
-
<?php
97
-
$date = new DateTime();
98
-

99
-
$date->setISODate(2008, 2);
100
-
echo $date->format('Y-m-d') . "\n";
101
-

102
-
$date->setISODate(2008, 2, 7);
103
-
echo $date->format('Y-m-d') . "\n";
104
-
?>
105
-
]]>
106
-
</programlisting>
107
-
<para>&style.procedural;</para>
108
-
<programlisting role="php">
109
-
<![CDATA[
110
-
<?php
111
-
$date = date_create();
112
-

113
-
date_isodate_set($date, 2008, 2);
114
-
echo date_format($date, 'Y-m-d') . "\n";
115
-

116
-
date_isodate_set($date, 2008, 2, 7);
117
-
echo date_format($date, 'Y-m-d') . "\n";
118
-
?>
119
-
]]>
120
-
</programlisting>
121
-
&examples.outputs;
122
-
<screen>
123
-
<![CDATA[
124
-
2008-01-07
125
-
2008-01-13
126
-
]]>
127
-
</screen>
128
-
</example>
129
-
<example>
130
-
<title>Values exceeding ranges are added to their parent values</title>
131
-
<programlisting role="php">
132
-
<![CDATA[
133
-
<?php
134
-
$date = new DateTime();
135
-

136
-
$date->setISODate(2008, 2, 7);
137
-
echo $date->format('Y-m-d') . "\n";
138
-

139
-
$date->setISODate(2008, 2, 8);
140
-
echo $date->format('Y-m-d') . "\n";
141
-

142
-
$date->setISODate(2008, 53, 7);
143
-
echo $date->format('Y-m-d') . "\n";
144
-
?>
145
-
]]>
146
-
</programlisting>
147
-
&example.outputs;
148
-
<screen>
149
-
<![CDATA[
150
-
2008-01-13
151
-
2008-01-14
152
-
2009-01-04
153
-
]]>
154
-
</screen>
155
-
</example>
156
-
<example>
157
-
<title>Finding the month a week is in</title>
158
-
<programlisting role="php">
159
-
<![CDATA[
160
-
<?php
161
-
$date = new DateTime();
162
-
$date->setISODate(2008, 14);
163
-
echo $date->format('n');
164
-
?>
165
-
]]>
166
-
</programlisting>
167
-
&examples.outputs;
168
-
<screen>
169
-
<![CDATA[
170
-
3
171
-
]]>
172
-
</screen>
173
-
</example>
174
-
</refsect1>
175
-

176
79
<refsect1 role="seealso">
177
80
&reftitle.seealso;
178
81
<simplelist>
179
-
<member><function>DateTime::setDate</function></member>
180
-
<member><function>DateTime::setTime</function></member>
82
+
<member><function>DateTimeImmutable::setISODate</function></member>
181
83
</simplelist>
182
84
</refsect1>
183
85

184
86
</refentry>
185
-

186
87
<!-- Keep this comment at the end of the file
187
88
Local variables:
188
89
mode: sgml
189
90