declare @date datetime set @date = '2011-1-31' SELECT D...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Poker Meta

Q&A about the site for serious players and enthusiasts of poker

declare @date datetime

set @date = '2011-1-31'

SELECT
DATEADD(WEEK,
CASE (MONTH(ApproxDate) - MONTH(@Date) + 12) % 12
WHEN 2 THEN -1
ELSE ThisDayNum - (DAY(ApproxDate) - 1) / 7
END,
ApproxDate)
FROM (
SELECT
ThisDayNum = (DAY(@Date) - 1) / 7,
ApproxDate = DATEADD(WEEK, 5, @Date)
) s

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results