第一,实现查询每月13至31日内之间的所有数据
searchtime=datevalue(Trim(Request.Form("datetime1")))
weekw1=searchtime
weekw2=dateadd("m",1,weekw1)
strsql="select * from "&findtype&" where 时间 between #"&weekw1&"# and #"&weekw2&"#"
rs.Open strsql, conn, adOpenStatic
第二,实现查询7月13至7月31日之间的所有数据
SQL Server
Select * from 表名 where DateAdd(year,DateDiff(year,字段名,GETDATE()),字段名) between DateAdd(year,DateDiff(year,''''2003-7-13'''',GETDATE()),''''2003-7-13'''') and DateAdd(year,DateDiff(year,''''2003-7-31'''',GETDATE()),''''2003-7-31'''')
网页
<%
sqlstr="Select * from 表名 where DateAdd(''''yyyy'''',DateDiff(''''yyyy'''',字段名," & now & "),字段名) between DateAdd(''''yyyy'''',DateDiff(''''yyyy'''',#2003-7-13#," & now & "),#2003-7-13#) and DateAdd(''''yyyy'''',DateDiff(''''yyyy'''',#2003-7-31#," & now & "),#2003-7-31#)"
%>
|