SQL Server的Datediff和Access的Datediff的区别

SQL Server的Datediff和Access的Datediff的区别

<script type="text/javascript">google_ad_client = "pub-2048279401139630";google_ad_slot = "8856771542";google_ad_width = 728;google_ad_height = 90;document.write("<s"+"cript type='text/javascript' s"+"rc='http://pagead2.googlesyndication.com/pagead/show_ads"+"."+"js'></scr"+"ipt>");</script>


What function does: returns a variant to reflect the time difference between two dates

Syntax: DateDiff( inteval, firstdate, seconddate [,firstweekday[ [ , firstweek])

Example

The following shods the difference in days between two dates:

= DateDiff("d", "11-05-2002", "11-07-2002") returns 2


The following table lists the valid time periods and their interval values.

  Time Interval  Syntax  
Year
yyyy

Quarter
q

Month
m

Day of year
y

Day
d

Weekday
w

Week
ww

Hour
h

Minute
n

Second
s




Note: Take special care for "ww" vs "w." "WW" is for a week.





AgeYrs: DateDiff("d",[INSERVICE],Now())/365
Gives me this result:

14.5972602739726

in SQL the function:

AgeYrs = DATEDIFF(d,INSERVICE,getdate())/365




其实就是"需要注意! 
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值