php 前一天或后一天的日期
前端之家收集整理的这篇文章主要介绍了
php 前一天或后一天的日期,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
<div class="codetitle"><a style="CURSOR: pointer" data="4917" class="copybut" id="copybut4917" onclick="doCopy('code4917')"> 代码如下:
<div class="codebody" id="code4917">
<?
PHP date_default_timezone_set('PRC');//默认时区
echo"今天:",date("Y-m-d",time()),"
";
echo"今天:",strtotime("18june2008")),"
";
echo"昨天:",strtotime("-1day")),"
";
echo"明天:",strtotime("+1day")),"
";
echo"一周后:",strtotime("+1week")),"
";
echo"一周零两天四小时两秒后:",date("Y-m-dG:H:s",strtotime("+1week2days4hours2seconds")),"
";
echo"下个星期四:",strtotime("nextThursday")),"
";
echo"上个周一:".date("Y-m-d",strtotime("lastMonday"))."
";
echo"一个月前:".date("Y-m-d",strtotime("lastmonth"))."
";
echo"一个月后:".date("Y-m-d",strtotime("+1month"))."
";
echo"十年后:".date("Y-m-d",strtotime("+10year"))."
";
?>