February 19, 2010 at 2:38 am
Our goal is to get the day of the week for the date '2009-12-17' as '5' regardless of the DateFirst setting.
SET DATEFIRST lets you define, when you want your week to start.
DATEPART (dw, <date>) gets you the "day of the week" for <date>, based upon the DATEFIRST definition we just did.
NOW:
"Our goal is to get the day of the week for the date '2009-12-17' as '5' regardless of the DateFirst setting."
sounds quite ... strange:
2009-12-17 was a Thursday.
You start your week on Sunday or Monday or Friday: 2009-12-17 was a Thursday!
Now: If you start your week on Monday, Thursday is the 4th day of the week, not the 5th.
Why should you make it the 5th, when it is the 4th?
Viewing 0 posts
You must be logged in to reply to this topic. Login to reply