Bug #74701 [Opn->Csd]: date("o", strtotime("2017-01-01")) returns "2016"

From: Date: Tue, 06 Jun 2017 12:00:17 +0000
Subject: Bug #74701 [Opn->Csd]: date("o", strtotime("2017-01-01")) returns "2016"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209392@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 User updated by: reinor2 at yandex dot ru Reported by: reinor2 at yandex dot ru Summary: date("o", strtotime("2017-01-01")) returns "2016" -Status: Open +Status: Closed Type: Bug Package: Date/time related Operating System: Linux PHP Version: 7.0.19 Block user comment: N Private report: N New Comment: Thanks, spam2! I need to be more attentive. Previous Comments: ------------------------------------------------------------------------ [2017-06-06 11:51:22] spam2 at rhsoft dot net 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 ------------------------------------------------------------------------ [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

« previous php.bugs (#209392) next »