php.net |  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
 [2018-03-25 21:53 UTC] tko at tourkick dot com
Description:
------------
---
From manual page: http://www.php.net/datetime.settime
---

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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-26 03:32 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2018-03-26 03:32 UTC] requinix@php.net
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. https://3v4l.org/1gsAT
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] requinix@php.net
-Status: Closed +Status: Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 12:01:30 2024 UTC