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

4
3
<refentry xml:id="datetimeimmutable.settimezone" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5
4
<refnamediv>
6
5
<refname>DateTimeImmutable::setTimezone</refname>
...
...
@@ -9,18 +8,75 @@
9
8

10
9
<refsect1 role="description">
11
10
&reftitle.description;
12
-
<methodsynopsis role="oop">
11
+
<methodsynopsis role="DateTimeImmutable">
13
12
<modifier>public</modifier> <type>DateTimeImmutable</type><methodname>DateTimeImmutable::setTimezone</methodname>
14
13
<methodparam><type>DateTimeZone</type><parameter>timezone</parameter></methodparam>
15
14
</methodsynopsis>
16
15
<para>
17
-
Like <methodname>DateTime::setTimezone</methodname> but works with
18
-
<classname>DateTimeImmutable</classname>.
16
+
Returns a new DateTimeImmutable object with a new timezone set.
19
17
</para>
20
18
</refsect1>
21
19

22
-
</refentry>
20
+
<refsect1 role="parameters">
21
+
&reftitle.parameters;
22
+
<variablelist>
23
+
<varlistentry>
24
+
<term><parameter>timezone</parameter></term>
25
+
<listitem>
26
+
<para>
27
+
A <classname>DateTimeZone</classname> object representing the
28
+
desired time zone.
29
+
</para>
30
+
</listitem>
31
+
</varlistentry>
32
+
</variablelist>
33
+
</refsect1>
34
+

35
+
<refsect1 role="returnvalues">
36
+
&reftitle.returnvalues;
37
+
<para>
38
+
Returns a new modified <classname>DateTimeImmutable</classname> object for
39
+
method chaining. The underlaying point-in-time is not changed when calling
40
+
this method.
41
+
</para>
42
+
</refsect1>
23
43

44
+
<refsect1 role="examples">
45
+
&reftitle.examples;
46
+
<example>
47
+
<title><function>DateTimeImmutable::setTimeZone</function> example</title>
48
+
<para>&style.oop;</para>
49
+
<programlisting role="php">
50
+
<![CDATA[
51
+
<?php
52
+
$date = new DateTimeImmutable('2000-01-01', new DateTimeZone('Pacific/Nauru'));
53
+
echo $date->format('Y-m-d H:i:sP') . "\n";
54
+

55
+
$newDate = $date->setTimezone(new DateTimeZone('Pacific/Chatham'));
56
+
echo $newDate->format('Y-m-d H:i:sP') . "\n";
57
+
?>
58
+
]]>
59
+
</programlisting>
60
+
&examples.outputs;
61
+
<screen>
62
+
<![CDATA[
63
+
2000-01-01 00:00:00+12:00
64
+
2000-01-01 01:45:00+13:45
65
+
]]>
66
+
</screen>
67
+
</example>
68
+
</refsect1>
69
+

70
+
<refsect1 role="seealso">
71
+
&reftitle.seealso;
72
+
<simplelist>
73
+
<member><function>DateTimeImmutable::getTimezone</function></member>
74
+
<member><function>DateTimeZone::__construct</function></member>
75
+
</simplelist>
76
+
</refsect1>
77
+

78
+

79
+
</refentry>
24
80
<!-- Keep this comment at the end of the file
25
81
Local variables:
26
82
mode: sgml
27
83