3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('Europe/Prague'); $tz = new \DateTimeZone('UTC'); $date = new \DateTime('2016-05-05 midnight', $tz); echo $date->format('c'); echo PHP_EOL; $date->modify('first day of this month midnight'); $date->modify('-2 months'); echo $date->format('c');

preferences:
29.72 ms | 402 KiB | 5 Q