Sorry - duplicate post (someone just beat me to it!) 🙂
Good article!
I think there might be some typos in the examples for finding dates in the past & future....this is what was shown:
SELECT DATEADD(wk, DATEDIFF(wk,0,GETDATE()), 2)
--: 2010-03-01 00:00:00.000 Start of the day 2 days from now
SELECT DATEADD(wk, DATEDIFF(wk,0,GETDATE()), -2)
--: 2010-02-25 00:00:00.000 Start of the day 2 days ago.
I believe it should be:
SELECT DATEADD(dd, DATEDIFF(dd,0,GETDATE()), 2)
--: 2010-03-01 00:00:00.000 Start of the day 2 days from now
SELECT DATEADD(dd, DATEDIFF(dd,0,GETDATE()), -2)
--: 2010-02-25 00:00:00.000 Start of the day 2 days ago.