cvs: phpdoc /en/functions datetime.xml

From: Date: Wed, 21 Nov 2001 23:21:31 +0000
Subject: cvs: phpdoc /en/functions datetime.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969339106@lists.php.net to get a copy of this message
philip Wed Nov 21 18:21:31 2001 EDT Modified files: /phpdoc/en/functions datetime.xml Log: strtotime() returns -1 upon failure, added another example too. Index: phpdoc/en/functions/datetime.xml diff -u phpdoc/en/functions/datetime.xml:1.53 phpdoc/en/functions/datetime.xml:1.54 --- phpdoc/en/functions/datetime.xml:1.53 Mon Nov 19 08:56:00 2001 +++ phpdoc/en/functions/datetime.xml Wed Nov 21 18:21:30 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.53 $ --> +<!-- $Revision: 1.54 $ --> <reference id="ref.datetime"> <title>Date and Time functions</title> <titleabbrev>Date/time</titleabbrev> @@ -1111,7 +1111,7 @@ <para> The function expects to be given a string containing an english date format and will try to parse that format into a UNIX - timestamp. + timestamp. Upon failure, <literal>-1</literal> is returned. <example> <title><function>strtotime</function> examples</title> <programlisting role="php"> @@ -1121,6 +1121,21 @@ echo strtotime ("+1 day") . "\n"; echo strtotime ("+1 week") . "\n"; echo strtotime ("+1 week 2 days 4 hours 2 seconds") . "\n"; +]]> + </programlisting> + </example> + </para> + <para> + <example> + <title>Checking for failure</title> + <programlisting role="php"> +<![CDATA[ +$str = 'Not Good'; +if (($timestamp = strtotime($str)) === -1) { + echo "The string ($str) is bogus"; +} else { + echo "$str == ". date('l dS of F Y h:i:s A',$timestamp); +} ]]> </programlisting> </example>

« previous php.doc (#969339106) next »