Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Calculating the Week of the Year when "Stat Week" runs Sunday through Saturday.

Calculating the Week of the Year when "Stat Week" runs Sunday through Saturday.

From: Tim Frawley <tim_frawley_at_fishgame.state.ak.us>
Date: 8 Feb 2005 13:22:30 -0800
Message-ID: <1107897750.131773.145900@l41g2000cwc.googlegroups.com>


I am attempting to calculate a "Stat Week" (week of year) based on a date value. Unfortunately our "Stat Weeks" run from Sunday to Saturday. These are the rules as they have been explained to me:

  1. The ADF&G Statistical Week is 7 days long and runs from Sunday through Saturday.
  2. The first Statistical week of the year may be less than 7 days and ends on the first Saturday.
  3. Subsequent weeks are numbered chronologically through the end of the year.

This renders the rather simple function to_char(datevalue, 'WW') inaccurate in for our situation.

Other than looping every single day of the year to get to the value needed, does anyone have an easier/faster/simpler solution? Received on Tue Feb 08 2005 - 15:22:30 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US