Bug #74701 [Com]: date("o", strtotime("2017-01-01")) returns "2016"
| From: | spam2 at rhsoft dot net | Date: | Tue, 06 Jun 2017 11:51:25 +0000 |
| Subject: | Bug #74701 [Com]: date("o", strtotime("2017-01-01")) returns "2016" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-209391@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74701&edit=1
ID: 74701
Comment by: spam2 at rhsoft dot net
Reported by: reinor2 at yandex dot ru
Summary: date("o", strtotime("2017-01-01")) returns "2016"
Status: Open
Type: Bug
Package: Date/time related
Operating System: Linux
PHP Version: 7.0.19
Block user comment: N
Private report: N
New Comment:
read the manual and use 'Y' when you mean 'Y'
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)
php > echo date("W", strtotime("2017-01-01"));
52
Previous Comments:
------------------------------------------------------------------------
[2017-06-06 11:45:19] reinor2 at yandex dot ru
Description:
------------
PHP 7.0.18-0ubuntu0.16.04.1 (cli) ( NTS )
Test script:
---------------
date_default_timezone_set("UTC");
echo date("o", strtotime("2017-01-01"));
// or, the same
// echo (new DateTime("2017-01-01"))->format("o");
Expected result:
----------------
2017
Actual result:
--------------
2016
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74701&edit=1