- Notifications
You must be signed in to change notification settings - Fork8k
Closed
Description
Description
Example:https://stackoverflow.com/questions/76384161/php-date-modify-returned-negative-microseconds
The following code:
<?php$datetime =date_create('now');$datetime->setTime(1,1,1,1/* If set to any other number, it works fine */);$datetime->modify('-100 ms');var_dump($datetime);
Resulted in this output:
object(DateTime)#1 (3) { ["date"]=> string(26) "2023-06-04 01:01:01.-99999" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam"}
But I expected this output instead:
object(DateTime)#1 (3) { ["date"]=> string(26) "2023-06-04 01:01:00.900001" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam"}
PHP Version
7.2 and greater
Operating System
No response