I'm trying to compare between two times: the $now_time
and $finish_time
.
the $finish_time
is +100 minute after $starting_time
.
i want to add if else on this times to do: if $now_time
is more than $finitsh_time
the result echo true
, else echo false
<?php
date_default_timezone_set("Asia/Tehran");
$now_time = date("Y-m-d h:i:s");
$starting_time = "2020-02-08 20:30:00";
$finish_time = strtotime("+100 minutes", strtotime($starting_time));
$date1 = DateTime::createFromFormat('Y-m-d h:i:s', $now_time);
$date2 = DateTime::createFromFormat('Y-m-d h:i:s', $finish_time);
if($date1 < $date2){
echo "True";
} else {
echo "False";
}
?>