|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: nask0 at cod3r dot net
New email:
PHP Version: OS:


 [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: Tue Aug 09 23:03:35 2022 UTC