3v4l.org

run code in 300+ PHP versions simultaneously
<?php $now = new DateTime(); $ts = (int)$now->format('U'); $midnight = $ts - $ts % 86400; $md = DateTime::createFromFormat('U', $midnight); var_dump($now, $ts, $midnight, $md); echo "\n\n"; $now_utc = (clone $now)->setTimezone(new DateTimeZone('UTC')); $new_midnight = (clone $now_utc)->modify('midnight'); $nmt = $new_midnight->format('U'); var_dump($now_utc, $new_midnight, $nmt);

preferences:
61.64 ms | 402 KiB | 5 Q