You were very close to the answer. To implement the custom logic you want, you can create a stored procedure or function. Use the following tsql as an example. Basically use the DateDiff SQL function, pass it "wk" for week and then the start and end date and SQL server will do all the work for you.
DECLARE @date DATETIME,
@Date2 datetime
SET @date='2015-12-28'
SET @date2='2015-12-29'
SELECT DATEDIFF ( wk , @date , @date2 )
SET @date2='2016-1-3'
SELECT DATEDIFF ( wk , @date , @date2 )
SET @date2='2016-5-28'
SELECT DATEDIFF ( wk , @date , @date2 )