Req #74797 [Opn->Wfx]: strtotime() doesn't accept date with spaces in it
| From: | cmb@php.net | Date: | Fri, 12 Mar 2021 10:50:20 +0000 |
| Subject: | Req #74797 [Opn->Wfx]: strtotime() doesn't accept date with spaces in it | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-232669@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74797&edit=1
ID: 74797
Updated by: cmb@php.net
Reported by: hofman dot tomas at gmail dot com
Summary: strtotime() doesn't accept date with spaces in it
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: Date/time related
PHP Version: Next Minor Version
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
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().
Previous Comments:
------------------------------------------------------------------------
[2017-06-22 21:25:23] derick@php.net
strtotime can't possibly support *all* formats in existence, that's why you can use
DateTime::createFromFormat instead:
https://3v4l.org/dXWqD
------------------------------------------------------------------------
[2017-06-22 14:15:09] hofman dot tomas at gmail dot com
Description:
------------
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:
---------------
<?php
echo var_dump(strtotime('22.6.2017'));
echo var_dump(strtotime('22. 6. 2017'));
?>
Expected result:
----------------
int(1498082400)
int(1498082400)
Actual result:
--------------
int(1498082400)
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74797&edit=1