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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
32 + 17 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Tue May 07 09:01:31 2024 UTC