纪念日倒计时程序

 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>";
时间: 2024-08-08 21:50:31

纪念日倒计时程序的相关文章

Js倒计时程序

Js倒计时程序 点击下载

Android使用Timer编写倒计时程序

开篇大家可以先看看Timer的基础用法,以及简单的原理.http://my.oschina.net/zhengweishan/blog/493891 Java之Timer使用.这里我要说的是Android使用Timer编写一个倒计时程序. 需求:实现简单的倒计时程序.要求可以根据用户的输入实现倒计时,时间到的时候有友好的提示. 分析:首先要实现这个功能,我想到的第一个方法就是使用Timer这个类.然后就是分析用户界面怎么设计,由于这个是简单程序,所以就采用Android原生的一些UI组件Butt

Android获取验证码后倒计时程序

在开发是经常会遇到获取短信验证码,然后获取验证码后需要等待1分钟倒计时,这是是不能再次发送短信请求的,这是需要一个倒计时程序 这里我封装了一个Util类,希望对开发的小伙伴能有帮助, public class TimeCountUtil extends CountDownTimer { private Activity mActivity; private Button btn;//按钮 // 在这个构造方法里需要传入三个参数,一个是Activity,一个是总的时间millisInFuture,

iOS中如何实现准确的倒计时程序 &middot; 九十里

iOS中倒计时程序,考虑线程暂停场景. iOS App进入后台时,GCD线程也会跟着暂停.当程序进入前台后,GCD线程恢复.因而倒计时程序需要考虑这一点,通过加入时间的比对来实现. + (void)countDownWithLapseTime:(int)lapseTime andBlock:(void(^)(int timeLapse)) countDownBlock{ __block dispatch_source_t timer; NSTimeInterval timeInterval=la

【c++程序】倒计时程序

#include<iostream> using namespace std; #include<ctime> class Clock{ int h; int m; int s; public: void set(int hour,int min,int sec);//set(int ,int ,int ) void tick(); void show(); void run(); }; void Clock::set(int hour,int min,int sec) { h=h

javascript 实现一个网页,然后计算出有多少剩余时间的倒计时程序

function counter() { var date = new Date(); var year = date.getFullYear(); var date2 = new Date(year, 12, 31, 23, 59, 59); /*转换成秒*/ var time = (date2 - date) / 1000; var day = Math.floor(time / (24 * 60 * 60)) var hour = Math.floor(time % (24 * 60 *

计算当年还剩多少时间的倒计时程序

<!DOCTYPE html > <html> <head> <title></title> </head> <body> <span></span> <script> function counter() { var date = new Date(); var year = date.getFullYear(); var date2 = new Date(year, 12, 31,

一个简单的游戏倒计时

一个简单的倒计时程序,60s倒数到0,然后返回60s继续倒数. 1 using UnityEngine; 2 using System.Collections; 3 4 public class Instantiate : MonoBehaviour { 5 public float targetTime = 60f; 6 public float currentTime = 0f; 7 // Use this for initialization 8 void Start () { 9 15

小代码 html倒计时

<Html> <Head> <title>纪念日倒计时</title> </Head> <Body  bgColor="#FFFFFF"> <SCRIPT language=JavaScript1.2> function setcountdown(theyear,themonth,theday){ yr=theyear;mo=themonth;da=theday } setcountdown(2017,