ASP时间差计算函数

程序代码 程序代码
<%
timediff "2010-6-18 19:01:00",now
'******时间差计算函数**********
function timediff(a,b)
s=DateDiff("s",a,b)
d=Fix(s/3600/24)
h=fix((s/3600-d*24))
m=fix((s/3600-d*24)*60-h*60)
ns=fix(((s/3600-d*24)*60-h*60-m)*60)
if d<>0 then
response.Write d&"天"
end if
if h<>0 then
response.Write " "&h&"小时"
end if
if m<>0 then
response.Write " "&m&"分钟"
end if
if ns<>0 then
response.Write " "&ns&"秒"
end if
end function
%>



文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
相关日志:
评论: 0 | 引用: 0 | 查看次数: -
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
t