Wednesday, August 27, 2014

Calculate number of weeks between dates


You nailed it! Thanks a ton!!


Best Regards,


N




Nichesl



Much simpler approach would be this





DECLARE @EndDateTime DATETIME = '8/25/2014'
DECLARE
@StartDateTime DATETIME = '8/3/2014'



SELECT DATEDIFF(dd,0,@EndDateTime)/7 - DATEDIFF(dd,0,@StartDateTime)/7 +1



Also it works independent of LANGUAGE settings


http://ift.tt/1rq71r4




Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://ift.tt/19nLNVq http://ift.tt/1iEAj0c


No comments:

Post a Comment