①当天
(OperateTime >=CONVERT(varchar(10),getDate(),120)+' 00:00:00' and OperateTime <=CONVERT(varchar(10),getDate(),120)+' 23:59:59')
②近三天
DateDiff(day,OperateTime,getdate()) <=3
③本周
sql数据库
Datepart(year,OperateTime)=DatePart(year,Getdate()) and DatePart(week,OperateTime)=DatePart(week,GetDate())
Access 数据库
Datepart('yyyy',OperateTime)=DatePart('yyyy',date()) and DatePart('ww',OperateTime)=DatePart('ww',Date())
④本月
Datepart(year,OperateTime)=DatePart(year,Getdate()) and DatePart(month,OperateTime)=DatePart(month,GetDate())
注:OperateTime是表中日期字段