php compare dates
$date_now = date("Y-m-d h:i:s"); $variable = new DateTime($date_now); $to_compare = "2018-06-01 12:48:09"; $variable1 = new DateTime($to_compare); $difference = date_diff($variable, $variable1)->format("Difference => %Y years, %m months, %d days, %h hours, and %i minutes"); echo $difference;