reference/datetime/datetime/setdate.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.setdate" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5
4
<refnamediv>
6
5
<refname>DateTime::setDate</refname>
...
...
@@ -11,14 +10,14 @@
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::setDate</methodname>
16
15
<methodparam><type>int</type><parameter>year</parameter></methodparam>
17
16
<methodparam><type>int</type><parameter>month</parameter></methodparam>
18
17
<methodparam><type>int</type><parameter>day</parameter></methodparam>
19
18
</methodsynopsis>
20
19
<para>&style.procedural;</para>
21
-
<methodsynopsis role="procedural">
20
+
<methodsynopsis>
22
21
<type>DateTime</type><methodname>date_date_set</methodname>
23
22
<methodparam><type>DateTime</type><parameter>object</parameter></methodparam>
24
23
<methodparam><type>int</type><parameter>year</parameter></methodparam>
...
...
@@ -28,6 +27,14 @@
28
27
<para>
29
28
Resets the current date of the DateTime object to a different date.
30
29
</para>
30
+
<para>
31
+
Like <methodname>DateTimeImmutable::setDate</methodname> but works with
32
+
<classname>DateTime</classname>, and changes the existing object.
33
+
</para>
34
+
<para>
35
+
The procedural version takes the <classname>DateTime</classname> object as
36
+
its first argument.
37
+
</para>
31
38
</refsect1>
32
39

33
40
<refsect1 role="parameters">
...
...
@@ -64,97 +71,18 @@
64
71
<refsect1 role="returnvalues">
65
72
&reftitle.returnvalues;
66
73
<para>
67
-
&date.datetime.return.modifiedobjectorfalseforfailure;
74
+
&date.datetime.return.modifiedobject;
68
75
</para>
69
76
</refsect1>
70
77

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

88
-
<refsect1 role="examples">
89
-
&reftitle.examples;
90
-
<example>
91
-
<title><function>DateTime::setDate</function> example</title>
92
-
<para>&style.oop;</para>
93
-
<programlisting role="php">
94
-
<![CDATA[
95
-
<?php
96
-
$date = new DateTime();
97
-
$date->setDate(2001, 2, 3);
98
-
echo $date->format('Y-m-d');
99
-
?>
100
-
]]>
101
-
</programlisting>
102
-
<para>&style.procedural;</para>
103
-
<programlisting role="php">
104
-
<![CDATA[
105
-
<?php
106
-
$date = date_create();
107
-
date_date_set($date, 2001, 2, 3);
108
-
echo date_format($date, 'Y-m-d');
109
-
?>
110
-
]]>
111
-
</programlisting>
112
-
&examples.outputs;
113
-
<screen>
114
-
<![CDATA[
115
-
2001-02-03
116
-
]]>
117
-
</screen>
118
-
</example>
119
-
<example>
120
-
<title>Values exceeding ranges are added to their parent values</title>
121
-
<programlisting role="php">
122
-
<![CDATA[
123
-
<?php
124
-
$date = new DateTime();
125
-

126
-
$date->setDate(2001, 2, 28);
127
-
echo $date->format('Y-m-d') . "\n";
128
-

129
-
$date->setDate(2001, 2, 29);
130
-
echo $date->format('Y-m-d') . "\n";
131
-

132
-
$date->setDate(2001, 14, 3);
133
-
echo $date->format('Y-m-d') . "\n";
134
-
?>
135
-
]]>
136
-
</programlisting>
137
-
&example.outputs;
138
-
<screen>
139
-
<![CDATA[
140
-
2001-02-28
141
-
2001-03-01
142
-
2002-02-03
143
-
]]>
144
-
</screen>
145
-
</example>
146
-
</refsect1>
147
-

148
78
<refsect1 role="seealso">
149
79
&reftitle.seealso;
150
80
<simplelist>
151
-
<member><function>DateTime::setISODate</function></member>
152
-
<member><function>DateTime::setTime</function></member>
81
+
<member><function>DateTimeImmutable::setDate</function></member>
153
82
</simplelist>
154
83
</refsect1>
155
84

156
85
</refentry>
157
-

158
86
<!-- Keep this comment at the end of the file
159
87
Local variables:
160
88
mode: sgml
161
89