php 时间,日期计算

阅读更多
转自:http://www.oschina.net/code/snippet_4873_3145

";
//明天
echo $tomorrow = date( 'Y-m-d', mktime(0,0,0,date('m') ,date('d')+1,date('Y')))."
"; //昨天 echo $yesterday = date( 'Y-m-d',mktime(0,0,0,date('m') ,date('d')-1,date('Y')))."
"; //上一个月 echo $lastmonth = date( 'Y-m-d', mktime(0,0,0,date('m')-1,date('d'), date('Y')))."
"; //下一年 echo $nextyear = date( 'Y-m-d', mktime(0,0,0,date('m'), date('d'), date('Y')+1))."
"; //明天 echo $tomorrow = date('Y-m-d',strtotime ('+1 day'))."
"; //明天 /*echo strtotime("now"), "\n"; echo strtotime("10 September 2000"), "\n"; echo strtotime("+1 day"), "\n"; echo strtotime("+1 week"), "\n"; echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\n"; echo strtotime("next Thursday"), "\n"; echo strtotime("last Monday"), "\n"; */ //使用strtotime增加日期 echo $date1 = strtotime('2010-08-09')."
"; echo date('Y-m-d',strtotime("+5 day",$date1)); //相应地,要增加月,年,将day改成month或year即可 ?>

你可能感兴趣的:(php,时间计算,日期计算)