|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76147 DateTime->setTime( 0, 0, 0 ) fast forwards to tomorrow if in the 23rd hour
Submitted: 2018-03-25 21:53 UTC Modified: 2018-03-26 19:10 UTC
From: tko at tourkick dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 7.2.3 OS:
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.
Block user comment
Status: Assign to:
Bug Type:
From: tko at tourkick dot com
New email:
PHP Version: OS:


 [2018-03-25 21:53 UTC] tko at tourkick dot com
From manual page:

If your DateTime object is in the 23rd hour, such as `2018-03-25 23:44:02.208780`, and you use `setTime( 0, 0, 0 )`, it will fast forward to tomorrow (`2018-03-26 00:00:00.000000`) instead of truncating the minutes (`2018-03-25 00:00:00.000000`), as it does for all other hours of the day.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-26 03:32 UTC]
-Status: Open +Status: Feedback
 [2018-03-26 03:32 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

Works for me.
Even works for timezones that began DST today at midnight (eg, Asia/Beirut).
 [2018-03-26 18:30 UTC] tko at tourkick dot com
-Status: Feedback +Status: Closed
 [2018-03-26 18:30 UTC] tko at tourkick dot com
Good idea to add a script. For some reason I wasn't able to replicate it again. Sorry for the trouble.
 [2018-03-26 19:10 UTC]
-Status: Closed +Status: Not a bug
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 20 07:01:28 2024 UTC