title: Get week start/end dates and week number for weeks starting on Thursday
body: <p>I have this existing project which is a weekly report. One of its parameters are the week range. It works fine but they need to rebump the report, instead of starting the week in the first day of the year they need to start the week on the first thursday and end on a wed. I have this query</p>
  
  <pre><code>SELECT   MIN([DATE]) as StartWeek
              ,MAX([DATE]) as EndWeek
              ,DATENAME(WEEK,Convert(datetime,CONVERT(VARCHAR(10),CONVERT(DATE,[DATE]),101))) as [WEEK]
  
      FROM [somedb]
      WHERE DATENAME(Year,Convert(datetime,CONVERT(VARCHAR(10),CONVERT(DATE,[DATE]),101))) = 2018
      GROUP BY DATENAME(WEEK,Convert(datetime,CONVERT(VARCHAR(10),CONVERT(DATE,[DATE]),101)))
  </code></pre>
  
  <p>The output of this query is</p>
  
  <pre><code>Start Week    End Week    WEEK
  2018-01-01    2018-01-07  1
  </code></pre>
  
  <p>The expected output should be</p>
  
  <pre><code>Start Week                                         End Week    Week
  2018-1-4(since its the first thursday of the week) 2018-1-10    1
  </code></pre>
  
  <p>Yes I can <code>DATEADD</code> but the week number will still acknowledge 2018-1-8 as <code>WEEK 2</code></p>