3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php if (!class_exists('DateTime') ) { die('Feature not available yet'); } echo "mine:\n"; $a = date_create("2016-04-30", new DateTimeZone("UTC")); $b = date_create("now"); var_dump($a, $b, $a<$b, $a==$b, $a>$b); echo "\n"; echo "Same date:\n"; $a = new DateTime('2015-01-31 01:23:45 UTC'); $b = new DateTime('2015-01-31 02:23:45 Europe/Paris'); var_dump($a, $b, $a<$b, $a==$b, $a>$b); echo "\n"; echo "First greater than second:\n"; $a = new DateTime('2015-01-31 01:23:46 UTC'); $b = new DateTime('2015-01-31 02:23:45 Europe/Paris'); var_dump($a, $b, $a<$b, $a==$b, $a>$b); echo "\n"; echo "First less than second:\n"; $a = new DateTime('2015-01-31 01:23:45 UTC'); $b = new DateTime('2015-01-31 02:23:46 Europe/Paris'); var_dump($a, $b, $a<$b, $a==$b, $a>$b);
based on kEB2m