title: Amazon - Redshift : Week number for a given date is coming wrong
body: <p>Considering Sunday as the first day of the week the below statements in redshift should return 2 as the week number instead returning 1. </p>
  
  <p>Mysql has a function called <a href="https://www.w3resource.com/mysql/date-and-time-functions/mysql-week-function.php" rel="nofollow noreferrer">Week()</a> where we can use the mode to get the desired result. Likewise is there any function in redshift that I could use to get the correct week number. </p>
  
  <p>Any help would be really appreciated.</p>
  
  <pre><code>SELECT EXTRACT(WEEK FROM TIMESTAMP '2018-01-07');
  
  SELECT TO_CHAR(TIMESTAMP '2018-01-07','WW');
  </code></pre>