<?php
//设置编码格式
header("Content-type: text/html; charset=utf-8");
$time1=strtotime(date("Y-m-d")); //获取当前时间戳
$time2=strtotime(date("2016-01-01"));//获取2016年元旦时间戳
echo $time1; //输出当前时间戳
echo "<br/>"; //换行
echo $time2; //输出2016年元旦时间戳
$time3=$time1-$time2;//当前时间戳减去2016元旦时间戳
echo "<br/>"; //换行
echo $time3; //输出当前时间戳减去2016年元旦的时间戳
echo "<br/>"; //换行
$day1=(int)3600*(int)24;//输出时间戳转换时间的换算率
$riqi=$time3/$day1; //输出当前过去的时间戳转换的时间
$guoquri=ceil($riqi);//将过去的日期取整
echo "2016年已经过去".$guoquri."天了!";
?>
最佳答案
