Bug #70956 [Opn->Dup]: DayOfYear ignores leap years
| From: | cmb@php.net | Date: | Tue, 14 Jun 2016 12:18:20 +0000 |
| Subject: | Bug #70956 [Opn->Dup]: DayOfYear ignores leap years | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-201601@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70956&edit=1
ID: 70956
Updated by: cmb@php.net
Reported by: braunert at bitsol dot de
Summary: DayOfYear ignores leap years
-Status: Open
+Status: Duplicate
Type: Bug
Package: Date/time related
Operating System: irrelevant
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> This bug is reported earlier, but till now not fixed.
Nevertheless, please don't report bugs twice.
Closing as duplicate of bug #62476.
Previous Comments:
------------------------------------------------------------------------
[2015-11-22 17:18:38] braunert at bitsol dot de
Description:
------------
The function DateTime::createFromFormat('z Y', "59 2016") return false values if
there is a leap year.
I can't check it with DateTime::createFromFormat('z', "59"), because the
leap year is next year, maybe than it's ok - but I don't think so.
This bug is reported earlier, but till now not fixed.
Test script:
---------------
$date = DateTime::createFromFormat('z Y', "58 2016");
echo $date->format('j. M. Y')."<br>"; // Result: 28. Feb. 2016
$date = DateTime::createFromFormat('z Y', "59 2016");
echo $date->format('j. M. Y')."<br>"; // Result: 1. Mar. 2016
$date = DateTime::createFromFormat('d m Y', "29 02 2016");
echo $date->format('j. M. Y')."<br>"; // Result: 29. Feb. 2016
$number = cal_days_in_month(CAL_GREGORIAN, 2, 2016); // 29
echo "$number";
Expected result:
----------------
28. Feb. 2016
29. Feb. 2016
29. Feb. 2016
29
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70956&edit=1