php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77144 strtotime date week conversion
Submitted: 2018-11-13 08:52 UTC Modified: 2018-11-13 09:56 UTC
From: frank dot hartmann at netfira dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 7.2.12 OS: Windows Server 2016
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: frank dot hartmann at netfira dot com
New email:
PHP Version: OS:

 

 [2018-11-13 08:52 UTC] frank dot hartmann at netfira dot com
Description:
------------
The 31st of December 2018 is converted to the first week of 2018 instead of the first week of 2019 when using a combination of strototime and date. 

Test script:
---------------
echo date("W-Y", strtotime("2018-12-31T00:00:00Z"))."\n"; //outputs 01-2018 instead of 01-2019
echo date("d-m-Y", strtotime("2018-12-31T00:00:00Z")); // correct calculation

Expected result:
----------------
I expect to see 01-2019 as the output of the first line


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-11-13 09:05 UTC] frank dot hartmann at netfira dot com
-Status: Open +Status: Closed
 [2018-11-13 09:05 UTC] frank dot hartmann at netfira dot com
using "o" as a parameter in date does the trick and yields expected results
 [2018-11-13 09:56 UTC] cmb@php.net
-Status: Closed +Status: Not a bug
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 07:01:33 2025 UTC