PHP计算时间剩余时间

PHP 1523 0 2013-04-30

PHP计算时间剩余时间
<body>
<p>1小时=60分钟=3600秒</p>
<p>1天=24 x 3600 = 86400秒 </p>
<p><?php
$endtime="2009-04-08 10:13:00";
$d1=substr($endtime,17,2); //秒
$d2=substr($endtime,14,2); //分
$d3=substr($endtime,11,2); // 时
$d4=substr($endtime,8,2); //日
$d5=substr($endtime,5,2); //月
$d6=substr($endtime,0,4); //年

echo date("Y-m-d H:i:s",time()+3600*8)."n<br>";
echo $endtime.'<br>';
$now_T=mktime();
$now_S=mktime("$d3","$d2","$d1","$d5","$d4","$d6");
echo $now_T."n<br>";
echo $now_S."n<br>";
$end_TS=($now_S-$now_T)/60;   //计算 剩余分钟
echo $end_TS."<br>";

//今天到2009年10月1日还有多少天
$Date_1=date("Y-m-d H:i:s");
$Date_2="2009-04-08 20:20:01";
$d1=strtotime($Date_1);
$d2=strtotime($Date_2);
$Days=round(($d2-$d1)/3600/24);
echo   "今天到{$Date_2}日还有".$Days."天<br><br>";

?></p>
</body>

上一篇:PHP数组进行排序

下一篇:PHP图片上传大集合

讨论数量:0

请先登录再发表讨论。 2024-04-29

天涯网魂
3 杠 5 星
TA 的文章
TA 的随言
TA 的资源链