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

4
3
<refentry xml:id="datetimeimmutable.settimestamp" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5
4
<refnamediv>
6
5
<refname>DateTimeImmutable::setTimestamp</refname>
7
-
<refpurpose>Sets the date and time based on an Unix timestamp</refpurpose>
6
+
<refpurpose>Sets the date and time based on a Unix timestamp</refpurpose>
8
7
</refnamediv>
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::setTimestamp</methodname>
14
-
<methodparam><type>int</type><parameter>unixtimestamp</parameter></methodparam>
13
+
<methodparam><type>int</type><parameter>timestamp</parameter></methodparam>
15
14
</methodsynopsis>
16
15
<para>
17
-
Like <methodname>DateTime::setTimestamp</methodname> but works with
18
-
<classname>DateTimeImmutable</classname>.
16
+
Returns a new <type>DateTimeImmutable</type> object constructed from the
17
+
old one, with the date and time set based on an Unix timestamp.
19
18
</para>
20
19
</refsect1>
21
20

22
-
</refentry>
21
+
<refsect1 role="parameters">
22
+
&reftitle.parameters;
23
+
<variablelist>
24
+
<varlistentry>
25
+
<term><parameter>timestamp</parameter></term>
26
+
<listitem>
27
+
<para>
28
+
Unix timestamp representing the date.
29
+
Setting timestamps outside the range of &integer; is possible by using
30
+
<methodname>DateTimeImmutable::modify</methodname> with the <literal>@</literal> format.
31
+
</para>
32
+
</listitem>
33
+
</varlistentry>
34
+
</variablelist>
35
+
</refsect1>
36
+

37
+
<refsect1 role="returnvalues">
38
+
&reftitle.returnvalues;
39
+
<para>
40
+
&date.datetimeimmutable.return.modifiedobject;
41
+
</para>
42
+
</refsect1>
23
43

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

55
+
$newDate = $date->setTimestamp(1171502725);
56
+
echo $newDate->format('U = Y-m-d H:i:s') . "\n";
57
+
?>
58
+
]]>
59
+
</programlisting>
60
+
&examples.outputs.similar;
61
+
<screen>
62
+
<![CDATA[
63
+
1272508903 = 2010-04-28 22:41:43
64
+
1171502725 = 2007-02-14 20:25:25
65
+
]]>
66
+
</screen>
67
+
</example>
68
+
</refsect1>
69
+

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

77
+

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