ASP时间差计算函数
作者:刚子 日期:2010-08-18
程序代码<%
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
%>
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
%>
评论: 0 | 引用: 0 | 查看次数: -
发表评论
上一篇
下一篇

文章来自:
Tags: