|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #74797 strtotime() doesn't accept date with spaces in it
Submitted: 2017-06-22 14:15 UTC Modified: 2021-03-12 10:50 UTC
From: hofman dot tomas at gmail dot com Assigned: cmb (profile)
Status: Wont fix Package: Date/time related
PHP Version: Next Minor Version 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.
Block user comment
Status: Assign to:
Bug Type:
From: hofman dot tomas at gmail dot com
New email:
PHP Version: OS:


 [2017-06-22 14:15 UTC] hofman dot tomas at gmail dot com
It will be nice, that strtotime() function could parse date format with dots and spaces to. Now strtotime('22.6.2017') returns 1498082400, but typographicaly correct version strtotime('22. 6. 2017') returns false. In some languages/typographic convetions (like Czech or German) format with spaces is correct, but strtotime() not supports it. Is it possible to have also this one?

Test script:

echo var_dump(strtotime('22.6.2017'));
echo var_dump(strtotime('22. 6. 2017'));


Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-06-22 21:25 UTC]
strtotime can't possibly support *all* formats in existence, that's why you can use DateTime::createFromFormat instead:
 [2021-03-12 10:50 UTC]
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2021-03-12 10:50 UTC]
I agree that we should not make strtotime() even more "flexible",
besides that we would need to implement our own parser, instead of
being able to use timelib_strtotime().
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Feb 04 00:03:40 2023 UTC