Bug #76147 [Fbk->Csd]: DateTime->setTime( 0, 0, 0 ) fast forwards to tomorrow if in the 23rd hour

From: Date: Mon, 26 Mar 2018 18:30:31 +0000
Subject: Bug #76147 [Fbk->Csd]: DateTime->setTime( 0, 0, 0 ) fast forwards to tomorrow if in the 23rd hour
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214492@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76147&edit=1

 ID:                 76147
 User updated by:    tko at tourkick dot com
 Reported by:        tko at tourkick dot com
 Summary:            DateTime->setTime( 0, 0, 0 ) fast forwards to
                     tomorrow if in the 23rd hour
-Status:             Feedback
+Status:             Closed
 Type:               Bug
 Package:            Date/time related
 PHP Version:        7.2.3
 Block user comment: N
 Private report:     N

 New Comment:

Good idea to add a script. For some reason I wasn't able to replicate it again. Sorry for the
trouble.


Previous Comments:
------------------------------------------------------------------------
[2018-03-26 03:32:20] 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-25 21:53:18] 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.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=76147&edit=1


Thread (4 messages)

« previous php.bugs (#214492) next »