T Sql List Week Start Date And End Date For

[Solved] T Sql List Week Start Date And End Date For | Php - Code Explorer | yomemimo.com
Question : t sql list week start date and end date for a year

Answered by : marc-heidemann

DECLARE @Date1 DATE, @Date2 DATE
SET @Date1 = DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)
SET @Date2 = DATEADD(yy, DATEDIFF(yy,0,getdate()) + 1, -1)
SELECT DISTINCT dateadd(ww, datediff(ww, 0,DATEADD(DAY,number+1,@Date1)), 0) [StartDate],	dateadd(ww, datediff(ww, 0,DATEADD(DAY,number+1,@Date1)), 6) [EndDate]
FROM master..spt_values
WHERE type = 'P'
AND DATEADD(DAY,number+1,@Date1) < @Date2

Source : | Last Update : Wed, 22 Jun 22

Answers related to t sql list week start date and end date for a year

Code Explorer Popular Question For Php