海口秀英隆智慧網絡科技工作室
咨詢熱線:400-822-8458 客戶服務:0898-32183600

Asp人性化時間函數(分鍾/小時/天/月前)

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

<%@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人性化時間函數(分鍾/小時/天/月前)</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("分鍾前")
end if
if diff>=3600 and diff<86400 then
response.Write(DateDiff("h",Dates,now()))
response.Write("小時前")
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("年(nián)前")
end if
end function

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

文章(zhāng)整理(lǐ): 世紀雲圖  /

以上信息與文章(zhāng)正文是不可(kě)分割的(de)一(yī)部分,如(rú)果您要轉載本文章(zhāng),請保留以上信息,謝謝!

版權申明:本站文章(zhāng)部份來自(zì)網絡,如(rú)有侵權,請聯系我們,我們收到後立即删除,謝謝!

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

微信
網站建設
軟件業務
網絡營銷
400電話