日期:2014-05-17  浏览次数:20623 次

ASP日期比较怪事

if  Formatdatetime("2012-05-04")<=Formatdatetime("2012-05-31") then
response.Write("小")
 else
 response.Write("大")
end if


2012-05-04到2012-05-09之间输出的数据是“大”!
但2012-05-01到2012-05-03是小的,10以后也是小的。
asp 数据

------解决方案--------------------
response.Write(Formatdatetime("2012-05-04"))
response.Write(Formatdatetime("2012-05-31"))
 
看看分别打印出来是什么?
------解决方案--------------------
日期比较和字符串比较是有差异的,楼主如果知道 【01】 和 【1】 是不一样大的就明白了。
------解决方案--------------------
asp日期比较用函数好点吧
datediff还是dateadd忘了……自己查查吧……