|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-07-17 00:58 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2018-07-17 00:58 UTC] requinix@php.net
[2018-07-17 01:33 UTC] a at b dot c dot de
[2018-07-17 07:45 UTC] bebd75kv6a at p6wsw dot anonbox dot net
-: pawlu dot kolo at yahoo dot pl
+: bebd75kv6a at p6wsw dot anonbox dot net
[2018-07-17 07:46 UTC] bebd75kv6a at p6wsw dot anonbox dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 04:00:01 2025 UTC |
Description: ------------ I found out that setISODate function does not set timestamp as expected. It sets proper date but time seems to be taken from current timestamp. I know that it is meant to set date but it should set 00:00:00 for time part to ensure repeatable results. Test script: --------------- $date='2018-06-29 00:00:00'; $startDate=(new DateTime())->setISODate(date('Y',strtotime($date)),date('W',strtotime($date)))->format('Y-m-d H:i:s'); $endDate=(new DateTime())->setISODate(date('Y',strtotime($date)), date('W',strtotime($date)), 7)->format('Y-m-d H:i:s'); $startTimestamp = (new DateTime())->setISODate(date('Y',strtotime($date)),date('W',strtotime($date)))->getTimestamp(); echo 'input = '.$date; echo '<br/>strtotime = '.strtotime($date); echo '<br/>setISODate->getTimestamp = '; echo $startTimestamp; echo '</br>startDate = '.$startDate.'<br/>endDate = '.$endDate; Expected result: ---------------- input = 2018-06-29 00:00:00 strtotime = 1530244800 setISODate->getTimestamp = 1529899200 startDate = 2018-06-25 00:00:00 endDate = 2018-07-01 00:00:00 Actual result: -------------- input = 2018-06-29 00:00:00 strtotime = 1530244800 setISODate->getTimestamp = 1529946301 startDate = 2018-06-25 13:05:01 endDate = 2018-07-01 13:05:01 or bit later: input = 2018-06-29 00:00:00 strtotime = 1530244800 setISODate->getTimestamp = 1529946704 startDate = 2018-06-25 13:11:44 endDate = 2018-07-01 13:11:44