Calculate days between current day and another day

202 Views Asked by At

I want to calculate days between 'today' and a given date, $m->status_date.

In the code below, the first part with text1 and text2 works well, but the second part with text3 and text4 doesn't work.

How should I change my code? Here is how I have my code currently:

   <?=($m->status_date!='0000-00-00' 
    ? "text1 ".$m->st_cnt.
    :"text2")
?>
<?=(strtotime('now')-strtotime($m->status_date)>=120 
&& $m->status_date!='0000-00-00' 
    ? "text3":"text4")
?>
1

There are 1 best solutions below

0
On BEST ANSWER
$date1=date_create("2013-03-15");
$date2=date_create("2013-12-12");
$diff=date_diff($date1,$date2);