海南(nán)世紀雲圖網絡科技有限公司
咨詢熱線:400-822-8458 客戶服務:0898-32183600

Asp人性化時間函數(分(fēn)鍾/小(xiǎo)時/天/月前)

發表于:2011-07-04 00:00:00來源:SOUAB.COM人氣:3050

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Asp人性化時間函數(分(fēn)鍾/小(xiǎo)時/天/月前)</title>
</head>

<body>
<%
function ShowDate(Dates)
diff=DateDiff("s",Dates,now())
if diff<=59 then
response.Write(diff)
response.Write("秒前")
end if
if diff>=60 and diff<3600 then
response.Write(DateDiff("n",Dates,now()))
response.Write("分(fēn)鍾前")
end if
if diff>=3600 and diff<86400 then
response.Write(DateDiff("h",Dates,now()))
response.Write("小(xiǎo)時前")
end if
if diff>=86400 and diff<604800 then
response.Write(DateDiff("d",Dates,now()))
response.Write("日前")
end if
if diff>=604800 and diff<2592000 then
response.Write(DateDiff("ww",Dates,now()))
response.Write("星期前")
end if
if diff>=2592000 and diff<31536000 then
response.Write(DateDiff("m",Dates,now()))
response.Write("個月前")
end if
if diff>=31536000 then
response.Write(DateDiff("yyyy",Dates,now()))
response.Write("年前")
end if
end function

ShowDate(""&date()-3&"")
Response.write("<BR><BR>")
ShowDate("2010-5-10")
Response.write("<BR><BR>")
ShowDate(""&now()&"")
%>
</body>
</html>

文章整理: 世紀雲圖  /

以上信息與文章正文是不可分(fēn)割的一(yī)部分(fēn),如果您要轉載本文章,請保留以上信息,謝謝!

版權申明:本站文章部份來自網絡,如有侵權,請聯系我(wǒ)們,我(wǒ)們收到後立即删除,謝謝!

特别注意:本站部份轉載文章言論不代表本站觀點,本站所提供的攝影照片,插畫,設計作品,如需使用,請與原作者聯系,版權歸原作者所有。

微信
網站建設
軟件業務
網絡營銷
400電(diàn)話(huà)