title: How can I getting for consistent week number from leap year or normal year
body: <p>Using PostgreSQL version 9.4.18, PostGIS Version 2.2
  I'm using this function, and I'm using WW because don't want ISO week numbers...just the week number starting from 1 January:</p>
  
  <pre><code>CREATE FUNCTION f_woy(timestamp with time zone) RETURNS int LANGUAGE sql
  IMMUTABLE AS $$SELECT to_char($1, 'WW')::int$$; 
  </code></pre>
  
  <p>When I run the following query, every 4 years, the week number changes it's a leap year. I'm trying to get consistent week numbers from year to year for a certain date. So, for instance, when I run</p>
  
  <pre><code>SELECT f_woy(('2007-06-24 14:19:46.502-07'::timestamp at time zone 'UTC' at 
  time zone 'america/los_angeles')::date) 
  </code></pre>
  
  <p>as woy for 2004, 2005, 2006, and 2007 I get:</p>
  
  <pre><code>woy integer
  25
  </code></pre>
  
  <p>But when I run it as:</p>
  
  <pre><code>SELECT f_woy(('2008-06-24 14:19:46.502-07'::timestamp at time zone 'UTC' at 
  time zone 'america/los_angeles')::date) 
  </code></pre>
  
  <p>I get </p>
  
  <pre><code>woy integer
  26
  </code></pre>
  
  <p>Is there a way I can ignore the leap years and keep everything consistent, so that all 06-24 would be week number 25. I saw some posts about determining whether it was a leap year or not, but I'm having a hard time integrating that logic so that I can apply it to all queries where I'm examining week numbers.</p>