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: finding weeks between dates in oracle

Re: finding weeks between dates in oracle

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Sat, 14 Jun 2003 15:49:19 +0800
Message-ID: <3EEAD37F.6279@yahoo.com>


jim agans wrote:
>
> what I need to do is get the number of weeks between 2 dates and turn
> it into a decimal for adding to a sum and then getting the avg for the
> number of records read.
>
> I have 2 dates ex: 01/27/2000 and 09/22/1999
> how do it get the number of weeks in between....ie: 12.4
> I will then add the 12.4 to (sum_field) and read another record
> and add 1 to a counter(rec_total)divide sum_field by records
> read(rec_count)
> say sum_field/ rec_count = 7.4 weeks
>
> I have looked at "between_months" but how do I convert it to
> weeks?
> thanks
> jim agans

Depends on your definition of 'weeks', but in the simplest case:

weeks = ( date1 - date2 ) / 7

hth
connor

-- 
=========================
Connor McDonald
http://www.oracledba.co.uk

"Some days you're the pigeon, some days you're the statue"
Received on Sat Jun 14 2003 - 02:49:19 CDT

Original text of this message

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