3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set("UTC"); $dt1 = new DateTime("2012-06-25"); $dt2 = new DateTime("2012-07-27"); $dt3 = new DateTime("2012-07-02"); $iv = $dt1->diff($dt2); var_dump($iv); $dt4 = $dt3->add($iv); echo $dt4->format("c");

preferences:
41.85 ms | 528 KiB | 13 Q