3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dateTimeStrBefore = "2024/09/01 10:00:00"; $dateTimeBefore = new DateTimeImmutable($dateTimeStrBefore); $dateTimeAfter = $dateTimeBefore->modify("-1 second"); var_dump($dateTimeBefore); var_dump($dateTimeAfter);

preferences:
26.94 ms | 404 KiB | 5 Q