芜湖网站开发

芜湖网站开发公司

发布时间 显示为多少小时前的效果

发布于:2016/12/22 阅读()次 标签:芜湖网站建设

asp开发技巧

发布时间 显示为多少小时前的效果,以下是芜湖网页制作提供实际代码

limit=DateDiff("s","2009-1-17 9:05:35","2009-2-17 10:05:55")
response.Write  limit&"秒"
response.Write  ("<hr>")
if (limit < 60) then   show_t = "刚刚"
if (limit >= 60 and limit < 3600) then  show_t = INT(limit/60) &"分钟前"
if (limit >= 3600 and limit < 86400) then   show_t = INT(limit/3600) &"小时前"
if (limit >= 86400 and limit < 2592000) then   show_t = INT(limit/86400) &"天前"
if (limit >= 2592000 and limit < 31104000) then   show_t = INT(limit/2592000)  &"个月前"
if limit >= 31104000 then  show_t = "很久前"
response.Write  (show_t)

上一篇:asp防止网站垃圾留言几种思路

下一篇:显示左边的n个字符自动识别汉字函数