title: Is it possible to set start of week for T-SQL DATEDIFF function?
body: <p>I use <a href="http://msdn.microsoft.com/en-us/library/ms189794.aspx" rel="noreferrer">DATEDIFF</a> function to filter records added this week only:</p>
  
  <pre><code>DATEDIFF(week, DateCreated, GETDATE()) = 0
  </code></pre>
  
  <p>and I noticed what it's assumed what week starts on Sunday. But in my case I would prefer to set start of week on Monday. Is it possible somehow in T-SQL?</p>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p><strong>Update:</strong></p>
  
  <p>Below is an example showing what DATEDIFF doesn't check <a href="http://msdn.microsoft.com/en-us/library/ms187766.aspx" rel="noreferrer">@@DATEFIRST</a> variable so I need another solution.</p>
  
  <pre><code>SET DATEFIRST 1;
  
  SELECT 
      DateCreated, 
      DATEDIFF(week, DateCreated, CAST('20090725' AS DATETIME)) AS D25, 
      DATEDIFF(week, DateCreated, CAST('20090726' AS DATETIME)) AS D26
  FROM
  (
      SELECT CAST('20090724' AS DATETIME) AS DateCreated
      UNION 
      SELECT CAST('20090725' AS DATETIME) AS DateCreated
  ) AS T
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>DateCreated             D25         D26
  ----------------------- ----------- -----------
  2009-07-24 00:00:00.000 0           1
  2009-07-25 00:00:00.000 0           1
  
  (2 row(s) affected)
  </code></pre>
  
  <p>26 Jul 2009 is Sunday, and I want DATEDIFF returns 0 in third column too. </p>