头像

PHP求时间间隔 n天、周、月、年后的时间

2018-07-03 16:35:47 浏览()   来源:http://www.phpdaima.com//jsfx-74.html   评论 ( 0 )   

<?php
date_default_timezone_set('PRC');   // 设置时区
 
$date1 = strtotime('2015-01-01');   //把日期转换成时间戳
$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>天<br /><br /><br />";
 
echo "当前时间   " . date("Y-m-d h:i:s",strtotime("now")). "<br />";
echo "后天时间   " . date("Y-m-d h:i:s",<code class="php functions" style="margin: 0px !important; padding: 0px !important; outline: 0px !important; border: 0px !important; background: none !important; vertical-align: baseline !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !impor


标签: php
广告不存在
评论0

后面还有条评论,点击查看>>

温馨提示:为规范评论内容,垃圾评论一律封号...