28,391
社区成员
发帖
与我相关
我的任务
分享
<script language="javascript" type="text/javascript" runat="server">
function time_To_hhmmss(seconds)
{
var tian;
var shi;
var fen;
var miao;
if(seconds==null||seconds<0){
return;
}
tian = Math.floor(seconds / 86400);
seconds = seconds - tian * 60 * 60 * 24;
shi = Math.floor(seconds / 3600);
seconds = seconds - shi * 60 * 60;
fen = Math.floor(seconds / 60);
seconds = seconds - fen * 60;
miao = seconds;
if(tian>0)
{
return tian+"天"+shi+"时"+fen+"分"+miao+"秒"
}
if(shi<24 && shi>0)
{
return shi+"时"+fen+"分"+miao+"秒"
}
if(fen <60 && fen >0 )
{
return fen+"分"+miao+"秒"
}
if(miao<60)
{
return miao+"秒"
}
}
</script>
<%
n = 24 * 60 * 60 - 2
Response.Write fmtSeconds(n)
Function fmtSeconds(n)
On Error Resume Next
Dim d, h , m, s, t
If Not IsNumeric(n) Then
fmtSeconds = ""
Exit Function
End If
d = n \ (24 * 60 * 60)
h = (n - d * (24 * 60 * 60)) \ (60 * 60)
m = (n - d * (24 * 60 * 60) - h * (60 * 60)) \ 60
s = n Mod 60
t = ""
If d > 0 Then t = t & d & "天"
If t <> "" Or h > 0 Then t = t & h & "小时"
If t <> "" Or m > 0 Then t = t & m & "分"
t = t & s & "秒"
fmtSeconds = t
End Function
%>