<?php // 各种时间函数 echo "现在:".date("Y-m-d H:i:s")."<br>"; echo "今天:".date("Y-m-d ")."<br>"; echo "明天:".date("Y-m-d",strtotime("+1 day")), "<br>"; echo "后天:".date("Y-m-d",strtotime("+2 day")), "<br>"; echo "昨天:".date("Y-m-d",strtotime("-1 day")). "<br>"; echo "前天:".date("Y-m-d",strtotime("-2 day")). "<br>"; echo "一周后:".date("Y-m-d",strtotime("+1 week")). "<br>"; echo "两周后:".date("Y-m-d",strtotime("+2 week")). "<br>"; echo "一周前:".date("Y-m-d",strtotime("-1 week")). "<br>"; echo "两周前:".date("Y-m-d",strtotime("-2 week")). "<br>"; echo "一周零一天一小时一秒后:".date("Y-m-d G:H:s",strtotime("+1 week 1 days 1 hours 1 seconds")). "<br>"; echo "下个星期四:".date("Y-m-d",strtotime("next Thursday")). "<br>"; echo "上个星期四:".date("Y-m-d",strtotime("last Thursday"))."<br>"; echo "一个月后:".date("Y-m-d",strtotime("+1 month"))."<br>"; echo "一个月前:".date("Y-m-d",strtotime("-1 month"))."<br>"; echo "一个月后:".date("Y-m-d",strtotime("next month"))."<br>"; echo "一个月前:".date("Y-m-d",strtotime("last month"))."<br>"; echo "五年后:".date("Y-m-d",strtotime("+5 year"))."<br>"; echo "明年:".date("Y-m-d",strtotime("+1 year"))."<br>"; echo "去年:".date("Y-m-d",strtotime("-1 year"))."<br>"; ?>
诸如next和last等同于+1和-1的方式,可以以此类推,举一反三,常用的时间函数。