php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47184 DATE_ISO8601 constant and date('c') mismatch
Submitted: 2009-01-21 17:07 UTC Modified: 2009-01-22 15:05 UTC
From: guilhermeblanco@php.net Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.8 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: guilhermeblanco@php.net
New email:
PHP Version: OS:

 

 [2009-01-21 17:07 UTC] guilhermeblanco@php.net
Description:
------------
Following the documentation, DATE_ISO8601 contains this syntax: 2005-08-15T15:52:01+0000

Also, date('c') documents that: ISO 8601 date (added in PHP 5)  	2004-02-12T15:19:21+00:00

We should keep consistency when supporting this spec.

I propose the change then to DATE_ISO8601 constant, defined in ext/date/php_date.c, line 714:

- #define DATE_FORMAT_ISO8601 "Y-m-d\\TH:i:sO"
+ #define DATE_FORMAT_ISO8601 "Y-m-d\\TH:i:sP" 

Reproduce code:
---------------
echo DATE_ISO8601 === date('c') ? 'true' : 'false';

Expected result:
----------------
true

Actual result:
--------------
false

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-22 14:34 UTC] iliaa@php.net
One is basic and the other is extended format, both are valid.
 [2009-01-22 15:03 UTC] guilhermeblanco@php.net
Ilia,

It's not a case of being short or full format.
It's a matter of consistency.

Even this value is valid: 20090122T130112Z0200

The question here is that both DATE_ISO8601 and date('c') should be consistent, since they refer to the same format.

I am just forwarding what I've heard not only once, but a couple of times from different work teams about this mismatch.

Regards,
 [2009-01-22 15:05 UTC] derick@php.net
tbh, I don't think we should change this either...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 20 17:01:30 2024 UTC