php strtotime()计算今天与指定日期之天数
- $date1 = strtotime('2011-04-30');
- $date2 = time();
-
- $nowtime=strftime("%y年-%m月-%d日 ",$date2);
-
- $days=round(($date1-$date2)/3600/24);
-
- echo "今天是<font color="red">".$nowtime."</font>";
- echo "<br/>距".strftime("%y年-%m月-%d日 ",$date1)."还有<font colr="red">".$days."</font>天";
-
- echo date("y-m-d h:i:s",strtotime("now")). "<br />";
- echo date("y-m-d h:i:s",strtotime("10 september 2000")). "<br />";
- echo date("y-m-d h:i:s",strtotime("+2 day")). "<br />";
- echo date("y-m-d h:i:s",strtotime("+1 week")). "<br />";
- echo date("y-m-d h:i:s",strtotime("+1 week 2 days 4 hours 2 seconds")). "<br />";
- echo date("y-m-d h:i:s",strtotime("next thursday")). "<br />";
- echo date("y-m-d h:i:s",strtotime("last monday")). "<br />";
- echo date("y-m-d h:i:s",strtotime("+3 day",strtotime('2001-01-01')));
|