How do you calculate the number of weeks between two dates?

前端 未结 2 411
南旧
南旧 2021-01-12 02:07

How do you calculate the number of weeks between two dates?

for example as follows

Declare @StartDate as DateTime = \"01 Jan 2009\";
Declare @EndDate         


        
2条回答
  •  渐次进展
    2021-01-12 03:02

    Use the Datediff function. datediff(ww,@startdate,@enddate)

    the ww tells the function what units you require the difference to be counted in.

    http://msdn.microsoft.com/en-us/library/ms189794.aspx

提交回复
热议问题