Home » SQL & PL/SQL » SQL & PL/SQL » correct week number (oracle 11g)
correct week number [message #605553] Fri, 10 January 2014 08:15 Go to next message
guddu_12
Messages: 227
Registered: April 2012
Location: UK
Senior Member
Dear All,

I have to display some data based on week number but when i query on date it give wrong week no.
select to_char(to_date('07-jan-2014','dd-mon-yyyy'),'ww') from dual;
it says 1 which is wrong as it falls in 2nd week. How can i get the correct week

Please advice.
Re: correct week number [message #605554 is a reply to message #605553] Fri, 10 January 2014 08:23 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>How can i get the correct week
on which date does week 2 start for you & why?

[Updated on: Fri, 10 January 2014 08:26]

Report message to a moderator

Re: correct week number [message #605556 is a reply to message #605554] Fri, 10 January 2014 08:29 Go to previous messageGo to next message
guddu_12
Messages: 227
Registered: April 2012
Location: UK
Senior Member
week 2nd started from monday i,e 06-jan-2014. 1st week actually had 2 dyas in 2013 and 01-jan fall in wed . i mean as per general calendar also week is starting from monday so 07-jan is tuesday and fall in 2nd week
Re: correct week number [message #605558 is a reply to message #605556] Fri, 10 January 2014 08:37 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
Read This
Re: correct week number [message #605563 is a reply to message #605556] Fri, 10 January 2014 10:02 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Quote:
i mean as per general calendar also week is starting from monday so 07-jan is tuesday and fall in 2nd week


There is no such general calendar.
There are multiple territorial calendars and one ISO calendar (without speaking about non-Gregorian ones).

Re: correct week number [message #605665 is a reply to message #605563] Mon, 13 January 2014 04:38 Go to previous message
guddu_12
Messages: 227
Registered: April 2012
Location: UK
Senior Member
Thanks for the help. the document helped me to resolve it
Previous Topic: Find the last process in string
Next Topic: Re: XML issue (split from hijacked thread http://www.orafaq.com/forum/t/189540/)
Goto Forum:
  


Current Time: Fri Apr 26 09:35:49 CDT 2024