|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72410 DateTime::format() displays char "T" when use DateTime::ATOM for parameter
Submitted: 2016-06-15 09:59 UTC Modified: 2016-06-26 04:22 UTC
From: nask0 at cod3r dot net Assigned:
Status: No Feedback Package: Documentation problem
PHP Version: 5.6.22 OS: Fedora
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
39 + 9 = ?
Subscribe to this entry?

 [2016-06-15 09:59 UTC] nask0 at cod3r dot net
When use \DateTime::format() with \DateTime::ATOM parameter, it displays char "T" instead of timezone abbreviation as described in manual.
Consider test script, it is pretty self-explanatory.	

Test script:
$date = new \DateTime( 'now', new \DateTimeZone('UTC') );

echo "\DateTime::ATOM format : " . $date->format( \DateTime::ATOM )."\n";
echo "'Y-m-d\TH:i:sP' format : " . $date->format( 'Y-m-d\TH:i:sP')."\n";
echo "Y-m-d T H:i:sP format : " . $date->format( "Y-m-d T H:i:sP")."\n";

Expected result:
\DateTime::ATOM format : 2016-06-15\UTC09:57:38+00:00
'Y-m-d\TH:i:sP' format : 2016-06-15\UTC09:57:38+00:00
Y-m-d T H:i:sP format : 2016-06-15 UTC 09:57:38+00:00

Actual result:
\DateTime::ATOM format : 2016-06-15T09:57:38+00:00
'Y-m-d\TH:i:sP' format : 2016-06-15T09:57:38+00:00
Y-m-d T H:i:sP format : 2016-06-15 UTC 09:57:38+00:00


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-15 10:53 UTC]
-Package: Date/time related +Package: Documentation problem
 [2016-06-15 10:53 UTC]
The actual result is correct, it should show the literal "T". Where in the documentation does it say it should be the timezone abbreviation?
 [2016-06-15 10:53 UTC]
-Status: Open +Status: Feedback
 [2016-06-26 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Aug 08 10:05:45 2022 UTC