I Need To Compare Two Date Time Variable in Php for my project what is the best way to compare
$date1 = \"2018-02-06 15:09:44\"; $date2 = \"2018-02-06 16:09:44\
$date1 = new DateTime("2018-02-06 15:09:44"); $date2 = new DateTime("2018-02-06 16:09:44"); if($date1 > $date2 ) { // statement }else { // other statement }