纪念日倒计时程序

 1 <?
 2     //功能:纪念日倒计时
 3     //时间:2015/05/19
 4     $now = strtotime("now");//获取当前时间
 5     $endtime = strtotime("2015-06-13 13:00:00");//设定考试时间
 6     
 7     $second = $endtime - $now;//考试时间与现在时间的差值
 8     $year = floor($second/3600/24/365);//从差值中算出有多少年
 9     
10     $temp = $second - $year * 3600 * 24 * 365;
11     $month = floor($temp/3600/24/30);//算出月
12     
13     $temp = $temp - $month * 3600 * 24 * 30;
14     $day = floor($temp /3600/24);//算出天
15     
16     $temp = $temp - $day * 3600 * 24;
17     $hour = floor($temp/3600);//算出小时
18     
19     $temp = $temp - $hour * 3600;
20     $minute = floor($temp/60);//算出分钟
21     
22     
23     $second1 = $temp - $minute * 60;//剩下的就是秒了
24     echo "<font size = 40px color = red>";
25     echo "距离六级考试还有{$year}年{$month}月{$day}天{$hour}小时{$minute}分钟{$second1}秒";
26     echo "</font>";

 

转载于:https://www.cnblogs.com/banshaohuan/p/4515079.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值