DateDiff 在ACCESS与SQL中的区别

在sql和access中用法
查询表中前10天数据
ACCESS中 :
sql=" select * from qiye where DATEDIFF('d',datetime,'"&date()&"')<=10" (备注:datetime字段 默认date())
sql中 :
sql=" select * from qiye where DATEDIFF(d,datetime,getdate())<=10"
看了以上不难区别,access中 d 要加上'',和 '"&date()&"'
获取现在时间 access中的date()和Now()
sql中getdate()  后边的时间减去前边的时间。
select DATEDIFF('d','2020/3/18 10:53:45','2020/3/15 21:33:46') 结果是 -3
select DATEDIFF('d','2020/3/15 21:33:46','2020/3/18 10:53:45') 结果是 3
第一个参数
yyyy 



m

y
一年的日数
d

w
一周的日数
ww

hh

n
分钟
s