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

Home -> Community -> Usenet -> c.d.o.server -> Re: Extracting week of the year from Date field

Re: Extracting week of the year from Date field

From: Oracleguru <oracleguru_at_mailcity.com>
Date: Fri, 31 Jul 1998 13:55:37 GMT
Message-ID: <01bdbc9a$b255e100$a504fa80@mndnet>


Try

select to_char(date1, 'W') week_of_month from dual; and
select to_char(date1, 'IW') week_of_year from dual;

These work from first day of the year or the first day of the month.

What may need to add or subtract a fixed number from your date field in the above statements to get what you desire.

Regards !!!

Oracleguru

rrachamallu_at_my-dejanews.com wrote in article <6pqqr1$7kv$1_at_nnrp1.dejanews.com>...
> Hi, I need to extract the week of the year/month from a date field. The
> calendar week starts on a sunday and ends on a saturday. For example July
1st
> ( wednesday) is in the first week of july and july 5th (sunday) is in the
> second week of july. So I cannot just use (day of the month / 7) to get
the
> week of the month. I am wondering if there is a built-in function in
oracle
> that can be used to do this. If you have a solution for this question,
please
> post the results.
>
> thanks.
> reddy
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
>
Received on Fri Jul 31 1998 - 08:55:37 CDT

Original text of this message

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