你如何计算两个日期之间的周数? [英] How do you calculate the number of weeks between two dates?
本文介绍了你如何计算两个日期之间的周数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何计算两个日期之间的周数?
How do you calculate the number of weeks between two dates?
例如如下
Declare @StartDate as DateTime = "01 Jan 2009";
Declare @EndDate as DateTime = "01 June 2009";
@StartDate and @EndDate
推荐答案
使用 Datediff 函数.datediff(ww,@startdate,@enddate)
Use the Datediff function. datediff(ww,@startdate,@enddate)
ww 告诉函数您需要计算差异的单位.
the ww tells the function what units you require the difference to be counted in.
http://msdn.microsoft.com/en-us/library/ms189794.aspx
这篇关于你如何计算两个日期之间的周数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文