Doc #80022 [Nab->Csd]: Inconsistency DateTimeInterface::ISO8601

[email protected] Fri, 22 Jul 2022 14:37:06 +0000
Newsgroups php.doc.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=80022&edit=1

 ID:                 80022
 Updated by:         [email protected]
 Reported by:        pablo at antweb dot es
 Summary:            Inconsistency DateTimeInterface::ISO8601
-Status:             Not a bug
+Status:             Closed
 Type:               Documentation Problem
 Package:            Date/time related
 PHP Version:        7.4.9
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of derickr
Revision: https://github.com/php/php-src/commit/6ae86c235820aaacfd6f7208fb54cb58212a3fac
Log: Fixed bug #80022: Support ISO 8601 years outside 0000-9999 range better


Previous Comments:
------------------------------------------------------------------------
[2020-08-27 06:57:03] pablo at antweb dot es

Amazing!
Mystery solved ... thank you.

------------------------------------------------------------------------
[2020-08-27 06:55:01] [email protected]

https://www.php.net/manual/en/class.datetimeinterface.php#datetime.constants.types
> Note: This format is not compatible with ISO-8601, but is left this way for
> backward compatibility reasons. Use DateTime::ATOM or DATE_ATOM for
> compatibility with ISO-8601 instead.

------------------------------------------------------------------------
[2020-08-27 06:51:13] pablo at antweb dot es

Correctly. 
This is the inconsistency.

Format "c" is a ISO 8601 date and have colon, and DateTimeInterface:ISO8601 = "Y-m-d\TH:i:sO" but does not have colon...

------------------------------------------------------------------------
[2020-08-26 23:12:03] [email protected]

That's right, 'O' does not have a colon while the timezone offset in 'c' does.

What bug are you reporting?

------------------------------------------------------------------------
[2020-08-26 21:40:49] pablo at antweb dot es

Description:
------------
In https://www.php.net/manual/en/class.datetime.php we have 

const string DateTimeInterface::ISO8601 = "Y-m-d\TH:i:sO" ;

The format 0 = Difference to Greenwich time (GMT) without colon between hours and minutes 	Example: +0200 (https://www.php.net/manual/en/datetime.format.php)

But the format('c') full date/time define:
c 	ISO 8601 date (added in PHP 5) 	2004-02-12T15:19:21+00:00

We can to see that the format is inconsistency, format "c" is not equal to Y-m-d\TH:i:sO it would be 2004-02-12T15:19:21+0000





------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=80022&edit=1