mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
strtotime: add last/next examples, document now parameter, add note about timestamp range
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@65063 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
02a9205752
commit
f0f1a3280d
1 changed files with 21 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.57 $ -->
|
||||
<!-- $Revision: 1.58 $ -->
|
||||
<reference id="ref.datetime">
|
||||
<title>Date and Time functions</title>
|
||||
<titleabbrev>Date/time</titleabbrev>
|
||||
|
@ -1112,12 +1112,13 @@ print (strftime ("%A.\n"));
|
|||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<simpara>
|
||||
The function expects to be given a string containing an English
|
||||
date format and will try to parse that format into a UNIX
|
||||
timestamp. Upon failure, <literal>-1</literal> is returned.
|
||||
The function expects to be given a string containing an English date
|
||||
format and will try to parse that format into a UNIX timestamp relative
|
||||
to the timestamp given in <parameter>now</parameter>, or the current time
|
||||
if none is supplied. Upon failure, <literal>-1</literal> is returned.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Since <function>strtotime</function> behaves according to GNU
|
||||
Because <function>strtotime</function> behaves according to GNU
|
||||
date syntax, have a look at the GNU manual page titled
|
||||
<ulink url="&url.gnu.man.date-input;">Date Input Formats</ulink>.
|
||||
Described there is valid syntax for the <parameter>time</parameter>
|
||||
|
@ -1128,11 +1129,13 @@ print (strftime ("%A.\n"));
|
|||
<title><function>strtotime</function> examples</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
echo strtotime ("now") . "\n";
|
||||
echo strtotime ("10 September 2000") . "\n";
|
||||
echo strtotime ("+1 day") . "\n";
|
||||
echo strtotime ("+1 week") . "\n";
|
||||
echo strtotime ("+1 week 2 days 4 hours 2 seconds") . "\n";
|
||||
echo strtotime ("now"), "\n";
|
||||
echo strtotime ("10 September 2000"), "\n";
|
||||
echo strtotime ("+1 day"), "\n";
|
||||
echo strtotime ("+1 week"), "\n";
|
||||
echo strtotime ("+1 week 2 days 4 hours 2 seconds"), "\n";
|
||||
echo strtotime ("next Thursday"), "\n";
|
||||
echo strtotime ("last Monday"), "\n";
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
@ -1152,6 +1155,14 @@ if (($timestamp = strtotime($str)) === -1) {
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
The valid range of a timestamp is typically from Fri, 13 Dec
|
||||
1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are
|
||||
the dates that correspond to the minimum and maximum values for
|
||||
a 32-bit signed integer.)
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
Loading…
Reference in a new issue