Home  >  Article  >  Database  >  DateDiff在Access与Sql server中的差别

DateDiff在Access与Sql server中的差别

WBOY
WBOYOriginal
2016-06-07 15:43:151619browse

语法 DateDiff(interval, date1, date2 [ , firstdayofweek ] [ , firstweekofyear ] ) 差别在于interval是否要用引号; Access:DateDiff('n',lastActiveTime,'" + DateTime.Now + "')=10 Sql server: DateDiff(n,lastActiveTime,'" + DateTime.Now + "')=10

语法

DateDiff(interval, date1, date2 [, firstdayofweek] [, firstweekofyear] )

 

差别在于interval是否要用引号;

Access:DateDiff('n',lastActiveTime,'" + DateTime.Now + "')>=10

Sql server:DateDiff(n,lastActiveTime,'" + DateTime.Now + "')>=10

interval 参数 (参数:为操作、事件、方法、属性、函数或过程提供信息的值。)包含以下设置:

设置 说明
yyyy
q 季度
m
y 某年的某一天
d
w 工作日
ww
h
n
s

 

参数 
Year
yyyy

Quarter
q

Month
m

Day of year
y

Day
d

Weekday
w

Week
ww

Hour
h

Minute
n

Second
s

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn