How to compare two time in PHP

you can try using strtotime

$st_time    =   strtotime($resttimefrom);
$end_time   =   strtotime($resttimeto);
$cur_time   =   strtotime(now);

then check

if($st_time < $cur_time && $end_time > $cur_time)
{
   echo "WE ARE CLOSE NOW !!";
}
else{
   echo "WE ARE OPEN  NOW !!";
}

i hope this may help you..

Leave a Comment