'--Divided into the Hour or Minute or second
strmm2=""
'-Day
nd2=Int(ntime2/(24*60)) '天
If nd2>0 Then
strmm2=strmm2+cstr(nD2)+"天/"
End If
nH2=Int((ntime2-nd2*24*60)/60) '小时
If nH2>0 Then
strmm2=strmm2+Cstr(nH2)+"小时/"
End If
nM2=ntime2-nd2*24*60-nH2*60 '分钟
If nM2>0 Then
strmm2=strmm2+Cstr(nM2)+"分钟/"
End If
nS2=(ntime2-nd2*24*60-nH2*60-nM2)/60 '秒
If ns2>0 Then
strmm2=strmm2+Cstr(nS2)+"秒"
End If
最后的结果是strmm2
用一条SQL语句,将以上综合起来
case when datediff(minute, '2008/11/11 13:23', '2008/11/11 19:23') < 24*60 then '' else
convert(varchar, datediff(minute, '2008/11/11 13:23', '2008/11/11 19:23')/(24*60)) + ' 天' end +
case when datediff(minute, '2008/11/11 13:23', '2008/11/11 19:23') < 60 then '' else
convert(varchar, datediff(minute, '2008/11/11 13:23', '2008/11/11 19:23')%(24*60)/60) + ' 小时 ' end +
convert(varchar, datediff(minute, '2008/11/11 13:23', '2008/11/11 19:23')%60) + ' 分钟'
















