title: Teradata Get Week Number using SQL Code
body: <p>I wish to get the week number from a date in teradata
  I can see there are solutions to use the Sys Calendar Table but i would like to use code to get the week number</p>
  
  <p>Week 28 for example is the 6th to the 12th of July inclusive</p>
  
  <p>I have found this <a href="https://forums.teradata.com/forum/database/getting-week-of-the-year-from-a-date" rel="nofollow">code</a> which works fine when you put DATE instead of cdate</p>
  
  <pre><code>SELECT 
  ((cdate - ((EXTRACT(YEAR FROM cdate) - 1900) * 10000 + 0101 (DATE))) -     ((cdate - DATE '0001-01-07') MOD 7)  + 13) / 7
  </code></pre>
  
  <p>My date is in the format MM/DD/YY and when i run it i get the error message</p>
  
  <pre><code>SELECT ((06/29/15 - ((EXTRACT(YEAR FROM 06/29/15) - 1900) * 10000 + 0101     (DATE))) - ((06/29/15 - DATE '0001-01-07') MOD 7)  + 13) / 7
  </code></pre>
  
  <p>"User cannot perform that operation on DATE"</p>
  
  <p>Any help would be greatly appreciated</p>