php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74701 date("o", strtotime("2017-01-01")) returns "2016"
Submitted: 2017-06-06 11:45 UTC Modified: 2017-06-06 12:35 UTC
From: reinor2 at yandex dot ru Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 7.0.19 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: reinor2 at yandex dot ru
New email:
PHP Version: OS:

 

 [2017-06-06 11:45 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-06-06 11:51 UTC] 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 12:00 UTC] reinor2 at yandex dot ru
-Status: Open +Status: Closed
 [2017-06-06 12:00 UTC] reinor2 at yandex dot ru
Thanks, spam2! I need to be more attentive.
 [2017-06-06 12:35 UTC] requinix@php.net
-Status: Closed +Status: Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 05:01:31 2024 UTC