Doc #78591 [Opn->Nab]: Short year to full year conversion range not specified
| From: | requinix@php.net | Date: | Mon, 23 Sep 2019 18:34:46 +0000 |
| Subject: | Doc #78591 [Opn->Nab]: Short year to full year conversion range not specified | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-16962@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78591&edit=1
ID: 78591
Updated by: requinix@php.net
Reported by: nerketur at hotmail dot com
Summary: Short year to full year conversion range not
specified
-Status: Open
+Status: Not a bug
Type: Documentation Problem
-Package: PHP Language Specification
+Package: Date/time related
Operating System: Windows
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
You aren't seeing it on the date() page because that function isn't the one that parses
date strings.
https://www.php.net/manual/en/datetime.createfromformat.php
> y
> A two digit representation of a year (which is assumed to be in the range 1970-2069, inclusive)
Previous Comments:
------------------------------------------------------------------------
[2019-09-23 18:29:10] nerketur at hotmail dot com
Description:
------------
As seen on the example code below, conversion to full year from short year is done in the range 1970
-> 2069. However, this is not specified in the documentation.
The reason this isn't "obvious" is because some languages allow you to specify the
range of conversion, and others seem to use a different range.
---
From manual page: https://php.net/function.date
---
Test script:
---------------
<?php
for ($x = 10; $x <= 99; $x++) {
$dateString = "1/1/$x";
echo "$dateString: " . DateTime::createFromFormat("m/d/y",
$dateString)->format("Y") . "<br>";
}
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78591&edit=1