title: Why is Redshift datediff giving different weeks when it is the same number of day difference?
body: <p>I'm trying to find the number of weeks between two days. When the difference is 8 days, I should be getting 1 or 2 weeks, depending on how the function works in Redshift (rounds up or down). However, it should be <strong>consistent</strong> whichever way it chooses.</p>
  
  <p>I realize that I could simply take the number of days and then divide by 7 and do either a ROUND or a CEIL, but I am simply trying to understand why DATEDIFF(weeks, date1, date2) provides either 1 or 2 when I have the two dates different by 8 days.</p>
  
  <pre><code>SELECT
  DATEDIFF(weeks, '2019-03-17', '2019-03-25') AS week_difference1,
  DATEDIFF(days, '2019-03-17', '2019-03-25') AS day_difference1,
  
  DATEDIFF(weeks, '2019-03-16', '2019-03-24') AS week_difference2,
  DATEDIFF(days, '2019-03-16', '2019-03-24') AS day_difference2
  </code></pre>
  
  <p>Result:
  week_difference1 = 1</p>
  
  <p>day_difference1  = 8</p>
  
  <p>week_difference2 = 2</p>
  
  <p>day_difference2  = 8</p>