DECLARE @SchDate datetime
SET @SchDate = getdate()
-- Gets Week Start Day
SELECT DATEADD(wk, DATEDIFF(wk, 6, @SchDate), 6) AS WeekStart
-- Gets Week End day
SELECT DATEADD(wk, DATEDIFF(wk, 5, @SchDate), 5) AS WeekEnd
-- Gets Month Start Day
SELECT dateadd(m, datediff(m, 0, @SchDate), 0) AS MonthStart
-- Gets Month End Day
SELECT dateadd(m, datediff(m, 0, dateadd(m, 1 ,@SchDate)), -1) AS MonthEnd
No comments:
Post a Comment