How to get weeknum for the given date [message #643529] |
Fri, 09 October 2015 15:43  |
 |
blyzz
Messages: 10 Registered: October 2015
|
Junior Member |
|
|
I am trying to get weeknum for the given dates with Monday being the start day for the week.
I can use below function but I need Monday as the start date
TO_CHAR(to_date(tbl1.date),'ww') AS WEEKNUM
Thanks,
Blyzzard
|
|
|
|
|
Re: How to get weeknum for the given date [message #643580 is a reply to message #643534] |
Mon, 12 October 2015 14:11   |
 |
blyzz
Messages: 10 Registered: October 2015
|
Junior Member |
|
|
I want to get the weeknum for the date range Oct2014-Sep 2015
so I want Monday oct 6 2014 as first week and so on.
select NEXT_DAY(TRUNC(TO_DATE('10/01/2014','MM/DD/YYYY'),'WW')-1,'MONDAY') + (1 - 1) * 7 FROM DUAL
I am getting the starting day for the week.
How can I use this to specify in my query if the mydate falls between NEXT_DAY(TRUNC(TO_DATE('10/01/2014','MM/DD/YYYY'),'WW')-1,'MONDAY') + (1 - 1) * 7 and
NEXT_DAY(TRUNC(TO_DATE('10/01/2014','MM/DD/YYYY'),'WW')-1,'MONDAY') + (1 - 1) * 7 then weeknum=1, if next week then weeknum=2 and so on?
Thanks,
Blyzz
|
|
|
|