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 -> Re: Weeknumber of a year

Re: Weeknumber of a year

From: Charles Hooper <hooperc2000_at_yahoo.com>
Date: 19 Jul 2006 14:01:31 -0700
Message-ID: <1153342891.408212.112510@m79g2000cwm.googlegroups.com>


purush.venkat_at_gmail.com wrote:
> Hi Experts,
>
> I have a question where in i have to get a weeknumber as follows :
>
> Week Week Ending
>
> 1 1/5/2006
> 2 1/12/2006
> 3 1/19/2006
> 4 1/26/2006
> 5 2/2/2006
> 6 2/9/2006
>
> etc. so on and so forth.
>
> Can anyone help me with this in ORACLE 9i please?
>
> Thanks,
> -- Tom .

Starting point - experiment:
Find the number of days, divide by 7, round up, add 1 to the result: SELECT
  CEIL((TRUNC(SYSDATE)-TO_DATE('01/05/2006','MM/DD/YYYY'))/7)+1 FROM
  DUAL; Plugging in a date in place of the current date in the previous statement:
SELECT CEIL((TO_DATE('01/04/2006','MM/DD/YYYY')-TO_DATE('01/05/2006','MM/DD/YYYY'))/7)+1 FROM
  DUAL; Charles Hooper
PC Support Specialist
K&M Machine-Fabricating, Inc. Received on Wed Jul 19 2006 - 16:01:31 CDT

Original text of this message

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