|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76125 error date_create_from_format
Submitted: 2018-03-21 12:21 UTC Modified: 2021-04-06 18:31 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: denorian at yandex dot ru Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 7.0.28 OS: linux
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.
Block user comment
Status: Assign to:
Bug Type:
From: denorian at yandex dot ru
New email:
PHP Version: OS:


 [2018-03-21 12:21 UTC] denorian at yandex dot ru
Error in reading the date in the function date_create_from_format

Test script:
$date = date_create_from_format("D, d M Y H:i:s O", "Tue, 20 Mar 2018 01:38:22 GMT");
echo date_format($date, 'Y-m-d');

//result 2018-03-20

$date = date_create_from_format("D, d M Y H:i:s O", "Tue, 21 Mar 2018 01:38:22 GMT");
echo date_format($date, 'Y-m-d');

//result 2018-03-27  27? Why?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-21 13:00 UTC]
-Package: date_time +Package: Date/time related
 [2018-03-21 13:00 UTC]
> //result 2018-03-27  27? Why?

Since there is no Tue, 21 Mar 2018, the parser apparently assumes
you've meant Tue, 27 Mar 2018 01:38:22 GMT.
 [2018-03-21 13:58 UTC] spam2 at rhsoft dot net
the parser should throw a warning

[builduser@testserver:/rpmbuild/SPECS]$ rpmlint fsync-tester.spec
fsync-tester.spec: E: specfile-error warning: bogus date in %changelog: Wed Feb 22 2018

because Wed is wrong, it was a tuesday
 [2021-04-06 18:31 UTC]
-Status: Open +Status: Not a bug
 [2021-04-06 18:31 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

This is expected behaviour, and is documented in the documentation:
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Jul 31 23:01:24 2021 UTC