计算当天和另一天之间的天数
Calculate days between current day and another day
我想计算 'today' 和给定日期 $m->status_date
之间的天数。
在下面的代码中,text1
和 text2
的第一部分运行良好,但 text3
和 text4
的第二部分不起作用。
我应该如何更改我的代码?这是我目前的代码:
<?=($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")
?>
$date1=date_create("2013-03-15");
$date2=date_create("2013-12-12");
$diff=date_diff($date1,$date2);
我想计算 'today' 和给定日期 $m->status_date
之间的天数。
在下面的代码中,text1
和 text2
的第一部分运行良好,但 text3
和 text4
的第二部分不起作用。
我应该如何更改我的代码?这是我目前的代码:
<?=($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")
?>
$date1=date_create("2013-03-15");
$date2=date_create("2013-12-12");
$diff=date_diff($date1,$date2);