xref: /PHP-7.4/ext/date/tests/bug46268.phpt (revision 8ac4d119)
1--TEST--
2Bug #46268 (When call DateTime#setTime, it seems to be called the last modify method too)
3--FILE--
4<?php
5date_default_timezone_set('Asia/Tokyo');
6
7$now = new DateTime('2008-10-10 01:02:03');
8echo $now->format("Y-m-d H:i:s") . PHP_EOL;
9
10$now->modify("1 day");
11echo $now->format("Y-m-d H:i:s") . PHP_EOL;
12
13$now->modify("1 hour");
14echo $now->format("Y-m-d H:i:s") . PHP_EOL;
15
16$now->setTime(0, 0, 0);
17//date_time_set($now, 0, 0, 0);
18echo $now->format("Y-m-d H:i:s") . PHP_EOL;
19--EXPECT--
202008-10-10 01:02:03
212008-10-11 01:02:03
222008-10-11 02:02:03
232008-10-11 00:00:00
24