Bug #77232 [Nab]: Wrong week of month for 2018-12-31
| From: | danack@php.net | Date: | Mon, 03 Dec 2018 14:21:14 +0000 |
| Subject: | Bug #77232 [Nab]: Wrong week of month for 2018-12-31 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-218256@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77232&edit=1
ID: 77232
Updated by: danack@php.net
Reported by: uli dot staerk at dc1 dot com
Summary: Wrong week of month for 2018-12-31
Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: Linux
PHP Version: 7.0.32
Block user comment: N
Private report: N
New Comment:
You probably want o/W
From: http://php.net/manual/en/function.date.php
Y A full numeric representation of a year, 4 digits
o ISO-8601 week-numbering year. This has the same value as Y, except that if the ISO week number (W)
belongs to the previous or next year, that year is used instead. (added in PHP 5.1.0)
Previous Comments:
------------------------------------------------------------------------
[2018-12-03 11:48:16] uli dot staerk at dc1 dot com
Meh! Think -> Report
------------------------------------------------------------------------
[2018-12-03 11:44:43] uli dot staerk at dc1 dot com
Description:
------------
The output for date("Y/W") is not correct for 2018-12-31!
Test script:
---------------
php > echo date("Y/W", strtotime('2018-12-30'));
2018/52
php > echo date("Y/W", strtotime('2018-12-31'));
2018/01
php > echo date("Y/W", strtotime('2019-01-01'));
2019/01
Expected result:
----------------
php > echo date("Y/W", strtotime('2018-12-31'));
2019/01
Actual result:
--------------
php > echo date("Y/W", strtotime('2018-12-31'));
2018/01
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77232&edit=1