PHP计算时间(倒计时)
$date1=strtotime('2012-01-01');//把日期转换成时间戳$date2=time(); //取当前时间的时间戳
$nowtime=strftime("%y年-%m月-%d日",$date2); //格式化输出日期
$days=round(($date1-$date2)/3600/24);//四舍五入
echo "今天是<font color=red>".$nowtime."</font>";
echo "<br />距2012年还有<font color=red>".$days."</font>天";
页:
[1]