Home » Developer & Programmer » Forms » Number of days between 2 dates
Number of days between 2 dates [message #183702] Sat, 22 July 2006 05:23 Go to next message
mudabbir
Messages: 235
Registered: April 2006
Location: Kuwait
Senior Member

I want to find the number of 'THURSDAYS' between 2 dates? is there any way i can do it in a procedure?
Re: Number of days between 2 dates [message #183730 is a reply to message #183702] Sat, 22 July 2006 14:47 Go to previous messageGo to next message
Frank Naude
Messages: 4502
Registered: April 1998
Senior Member
A query like this should do it:

SELECT SUM(DECODE(To_char(To_date(:startdate,'dd-mon-yyyy') + ROWNUM - 1,
                          'DY'),'THU',1, 0))
FROM   All_Objects
WHERE  ROWNUM <= To_date(:enddate,'dd-mon-yyyy')
               - To_date(:startdate,'dd-mon-yyyy') + 1
Re: Number of days between 2 dates [message #183982 is a reply to message #183702] Mon, 24 July 2006 12:09 Go to previous messageGo to next message
joy_division
Messages: 4641
Registered: February 2005
Location: East Coast USA
Senior Member
What, you didn't like the answer to the question you asked about how many TUESDAY's between 2 dates over here?

http://www.orafaq.com/forum/m/183696/66800/#msg_183696

I don't think it really required too much effort to change to the code to look for THURSDAY's instead of TUESDAY's.
Re: Number of days between 2 dates [message #184038 is a reply to message #183702] Tue, 25 July 2006 00:47 Go to previous message
mudabbir
Messages: 235
Registered: April 2006
Location: Kuwait
Senior Member

Thanks joy_division....but i had already got the answer some time ago and it worked perfectly...
Previous Topic: How To Solve This ??
Next Topic: khjk
Goto Forum:
  


Current Time: Tue Dec 06 14:04:55 CST 2016

Total time taken to generate the page: 0.12624 seconds