首页 | 免费域名 | 个人服务器 | 一流信息监控拦截系统 | 虚拟主机知识库 | ASP 空间 | ASP技术大全 | 下载中心 | 客户服务中心
  7i24 > ASP技术大全 > 代码乐园 >
    7i24 .Com  
  计算某事件要发生时间的倒计时程序

7i24.Com不停为您服务


时间格式应为:MM/DD/YYYY HH:MM:SS

<%
Function CountDown(dtmWhenEnds)
  Dim dtmNow
  Dim strTimeLeft

  Dim intDiffsR
  Dim intDiffmR
  Dim intDiffhR
  Dim intDiffdR

  Dim intDiffsA
  Dim intDiffmA
  Dim intDiffhA
  Dim intDiffdA

  Dim strDayS
  Dim strHourS
  Dim strMinuteS
  Dim strSecondS

  dtmNow = Now()

  If dtmWhenEnds > dtmNow Then

   intDiffsR = DateDiff("s", dtmNow, dtmWhenEnds)
   intDiffmR = intDiffsR \ 60
   intDiffhR = intDiffmR \ 60
   intDiffdR = intDiffhR \ 24
   intDiffsA = intDiffsR - (intDiffmR * 60)
   intDiffmA = intDiffmR - (intDiffhR * 60)
   intDiffhA = intDiffhR - (intDiffdR * 24)
   intDiffdA = intDiffdR

   If intDiffdA = 1 Then
     strDayS = " Day, "
   Else
     strDayS = " Days, "
   End If

   strTimeLeft = strTimeLeft & intDiffdA & strDayS

   If intDiffhA = 1 Then
     strHourS = " Hour, "
   Else
     strHourS = " Hours, "
   End If

   strTimeLeft = strTimeLeft & intDiffhA & strHourS

   If intDiffmA = 1 Then
     strMinuteS = " Minute, "
   Else
     strMinuteS = " Minutes, "
   End If

   strTimeLeft = strTimeLeft & intDiffmA & strMinuteS

   If intDiffsA = 1 Then
     strSecondS = " Second "
   Else
     strSecondS = " Seconds "
   End If

   strTimeLeft = strTimeLeft & intDiffsA & strSecondS

  Else
   strTimeLeft = "Countdown has ended"
  End If
  CountDown = strTimeLeft
End Function
%>



  2002年1月14日  阅读 1522 次  发送此页给朋友  来源:    版权争议  删除

相关文章:   近期热点:

上一篇: 选择最快的镜像站点
下一篇: 在特定时间显示特定问候语
返回上一层...
搜索:

(C)2004-2022 7i24.Com 保留所有权利