在kh_plan表中有两个字段sk_dat(收款日期)和gd_dat(归档日期)
我想比较两个日期,如果gd_dat比sk_dat晚20就进行扣分,判断的句子如下:
<%
set rs3=server.CreateObject( "adodb.recordset ")
sql3= "select * from kh_plan where year(sk_day)= "&y& " and month(sk_day)= "&m& " and kh_name= '无锡富士 ' order by xd_dat "
rs3.open sql3,conn,3,2
rs3.movefirst
t5=0
ccc=1
for k=1 to rs3.recordcount
t6=0
'以上句型可以不看
主要是下面*****这句认不出来
***** aa1=datediff( "d ",(rs3( "sk_day ")),(rs3( "gd_day ")))
if aa1> 20 then
……(执行扣分)
%>
现在的问题是datediff这句有问题,如果我把后面的rs3( "gd_day ")改为date()就可以判断出来,而且rs3( "gd_day ")肯定不为空值,请帮忙看一下,谢谢!
------解决方案--------------------
aa1 = datediff( "d ",CDate( "2007-4-3 "),CDate( "2007-4-30 ")) 也是可以的。确定gd_dat没问题吗?
试试看
sk_dat = rs( "sk_dat ").Value
gd_dat = rs( "gd_dat ").Value
aa1 = datediff( "d ",CDate(sk_dat),CDate(gd_dat))