ASP 时间判断 我糊涂了

来源:百度知道 编辑:UC知道 时间:2024/04/29 02:20:51
if now()>rs("dtime") then
response.Write "<script>alert('你的使用时间已经过期!请于管理员联系!');history.go(-1);</script>"
response.End
end if

我的判断`````````

dtime字段时间是 2000-12-29 13:41:19
now() 当时时间是 2000-12-29 17:41:19

为什么还进的去啊 ``````为什么啊 `````````
if now()>rs("dtime") then
response.Write "<script>alert('你的使用时间已经过期!请于管理员联系!');history.go(-1);</script>"
response.End
end if
也就是 如果服务器的时间大于```` dtime 这里面的时间 就 弹出 你的使用时间已经过期!请于管理员联系

我把 dtime 时间 设置为 2005 年 怎么还进的去啊

可能你数据库中的记录,不是日期时间格式。可以这样来判断if now() > cdate(rs("dtime")) then, 也可以使用计算结果出来判断if datediff("s", rs("dtime"),now()) > 0 then。

用Datediff函数:
if Datediff("s",rs("dtime"),now)>0 then
......

end if

rs("dtime") 不会读出分和秒的,不信你自己输出数据看就知道了