php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #36598 incorrect example for date() constant
Submitted: 2006-03-03 06:06 UTC Modified: 2006-03-06 23:52 UTC
From: d dot begley at uws dot edu dot au Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: *
Private report: No CVE-ID: None
 [2006-03-03 06:06 UTC] d dot begley at uws dot edu dot au
Description:
------------
The documentation for date() gives a number of examples for the new constants added in PHP 5.1.1:

http://www.php.net/manual/en/ref.datetime.php

The first example:

DATE_ATOM  (string)
    Atom (example: 2005-08-15T15:52:01+00:00)

is incorrect - the actual output has no colon in the timezone offset (though I believe one is missing from the W3C format, though I'll file a separate bug for that).


Reproduce code:
---------------
Simple function call:

date( DATE_ATOM, getlastmod() )

produces output of the form:

2006-03-03T15:41:46+1100

which according to the documentation should be:

2006-03-03T15:41:46+11:00

(ie., colon in timezone offset).  The documentation and code are inconsistent.


Expected result:
----------------
See "reproduce code" section;  expected output (as per documentation) is:

2006-03-03T15:41:46+11:00

Actual result:
--------------
See "reproduce code" section;  actual result is:

2006-03-03T15:41:46+1100


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-03 08:46 UTC] derick@php.net
The documentation for DATE_ATOM is correct, the one for DATE_W3C isn't. I will fix the code in a bit too.
 [2006-03-04 02:52 UTC] bjori@php.net
I've kinda been expecting reports like this.

We'll need to document the changed behaviour.
Something along the lines of this patch maybe..
http://php.is/bugs/36598/phpdoc.datetime.patch.txt

Index: constants.xml
===================================================================
RCS file: /repository/phpdoc/en/reference/datetime/constants.xml,v
retrieving revision 1.6
diff -u -r1.6 constants.xml
--- constants.xml       31 Jan 2006 21:10:31 -0000      1.6
+++ constants.xml       4 Mar 2006 01:39:00 -0000
@@ -17,6 +17,9 @@
     <simpara>
      Atom (example: 2005-08-15T15:52:01+00:00)
     </simpara>
+    <note>
+     <para>Prior to PHP5.1.3 DATE_ATOM didn't have colon in the timezone offset</para>
+    </note>
    </listitem>
   </varlistentry>
   <varlistentry>
@@ -114,8 +117,11 @@
    </term>
    <listitem>
     <simpara>
-     World Wide Web Consortium (example: 2005-08-15T15:52:01+0000)
+     World Wide Web Consortium (example: 2005-08-15T15:52:01+00:00)
     </simpara>
+    <note>
+     <para>Prior to PHP5.1.3 DATE_W3C didn't have colon in the timezone offset</para>
+    </note>
    </listitem>
   </varlistentry>
  </variablelist>

 [2006-03-04 13:15 UTC] derick@php.net
You don't have to document bugs like this...
 [2006-03-06 23:52 UTC] nlopess@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2020-02-07 06:11 UTC] phpdocbot@php.net
Automatic comment on behalf of nlopess
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=c621e11b29aec505e190ad18261864b825d23aaf
Log: fix #36598: update W3C date example
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 23:01:33 2025 UTC