海南世纪云图网络科技有限公司
咨询热线:400-822-8458 客户服务:0898-32183600 无障碍阅读 适老模式

Asp人性化时间函数(分钟/小时/天/月前)

发表于:2011-07-04 00:00:00来源:SOUAB.COM人气:3087

<%@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("年前")
end if
end function

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

文章整理: 世纪云图  https://www.yuntop.cc/

以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

版权申明:本站文章部份来自网络,如有侵权,请联系我们,我们收到后立即删除,谢谢!

特别注意:本站部份转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有。

微信
网站建设
软件业务
网络营销
400电话