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 = "2018-02-06 15:09:44"; $date2 = "2018-02-06 16:09:44"; if(strtotime($date1) < strtotime($date2)) { echo "date1 less than date2"; } else { echo "date1 is greater than date2; }