Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Extracting week of the year from Date field
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
Have a look at the following examples:
They use the TO_CHAR function to convert the date (sysdate in the examples)
to a string for the day of the week.
SQL> select to_char(sysdate,'DAY') from dual;
TO_CHAR(SYSDATE,'DAY')
TO_CHAR(SYSDATE,'DY')
-Richard Received on Thu Jul 30 1998 - 20:43:46 CDT
![]() |
![]() |