Doc #61314 [Ver->Csd]: Cannot mix European and 2 digit year
| From: | cmb@php.net | Date: | Tue, 01 Sep 2015 23:55:18 +0000 |
| Subject: | Doc #61314 [Ver->Csd]: Cannot mix European and 2 digit year | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12695@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61314&edit=1
ID: 61314
Updated by: cmb@php.net
Reported by: mwwaygoo at hotmail dot com
Summary: Cannot mix European and 2 digit year
-Status: Verified
+Status: Closed
Type: Documentation Problem
Package: Date/time related
Operating System: Ubuntu 11.10
PHP Version: 5.3.10
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
Previous Comments:
------------------------------------------------------------------------
[2015-09-01 23:52:23] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=337698
Log: clarified behavior of nn-nn-nn parsing (fixes #61314)
------------------------------------------------------------------------
[2015-08-31 18:21:32] cmb@php.net
> Specifying a date of 10-11-77 will epoch, [â¦]
No, strtotime() will fail for such a "date", and return FALSE as
documented.
> This should really say "whereas if the separator is a dot (.),
> then the European d.m.y format is assumed".
I agree, that some clarification in the manual is in order.
------------------------------------------------------------------------
[2012-03-07 09:14:54] mwwaygoo at hotmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.strtotime
---
Specifying a date of 10-11-77 will epoch, and not create the timestamp for 10-11-1977 as expected,
according to the two notes on the strtotime() function page shown below.
This should really say "whereas if the separator is a dot (.), then the European d.m.y format
is assumed"
Note:
If the number of the year is specified in a two digit format, the values between 00-69 are
mapped to 2000-2069 and 70-99 to 1970-1999.
Note:
...whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is
assumed.
Test script:
---------------
echo date("Y-m-d H:i:s", strtotime("10-11-77 03:12:01")); // unexpected fail:
supposed to be d/m/y with year 77 auto changed to 1977
echo date("Y-m-d H:i:s", strtotime("10.11.77 03:12:01")); // pass: EUR d/m/y
with year 77 auto changed to 1977
echo date("Y-m-d H:i:s", strtotime("10/11/77 03:12:01")); // pass: US m/d/y
echo date("Y-m-d H:i:s", strtotime("77-11-10 03:12:01")); // pass: ISO 8601
y-m-d
echo date("Y-m-d H:i:s", strtotime("77/11/10 03:12:01")); // expected fail: US
m/d/y data incorrect
Expected result:
----------------
1977-11-10 03:12:01
1977-11-10 03:12:01
1977-10-11 03:12:01
1977-11-10 03:12:01
1970-01-01 00:00:00
Actual result:
--------------
1970-01-01 00:00:00
1977-11-10 03:12:01
1977-10-11 03:12:01
1977-11-10 03:12:01
1970-01-01 00:00:00
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61314&edit=1