Convert week number back into the date range for that week using T-SQL
DECLARE @Week INT
DECLARE @Year NVARCHAR(4);
SELECT @Year = 2014, @Week = 40
SELECT DATEADD(WEEK, DATEDIFF(WEEK, 6, '1/1/' + @Year) + (@Week-1), 6) AS StartOfWeek;
SELECT DATEADD(WEEK, DATEDIFF(WEEK, 5, '1/1/' + @Year) + (@Week-1), 5) AS EndOfWeek;
No comments:
Post a Comment