Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Anyone have a DAYS_BETWEEN function?

Re: Anyone have a DAYS_BETWEEN function?

From: Connor McDonald <mcdonald.connor.cs_at_bhp.com.au>
Date: Wed, 03 Mar 1999 15:19:11 +0800
Message-ID: <36DCE26F.5B9D@bhp.com.au>


cjdavies1999_at_my-dejanews.com wrote:
>
> I am looking for a DAYS_BETWEEN function, similar to the MONTHS_BETWEEN
> function provided by Oracle. I would also like to be able to have a more
> general form of the ADD_MONTHS function, something like ADD_TO_DATE(
> date_to_increment, increment ammount, increment_unit).
>
> I welcome any pointers to Web sites where I can find date functions for Oracle
> would be greatly appreciated.
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own

create or replace
function days_between ( date1 date, date2 date ) return number is begin
  return date1 - date2;
end;
/

create or replace
function whole_days_between ( date1 date, date2 date ) return number is begin
  return trunc(date1) - trunc(date2);
end;
/

etc etc
--



Connor McDonald
BHP Information Technology
Perth, Western Australia
"Never wrestle a pig - you both get dirty and the pig likes it..." Received on Wed Mar 03 1999 - 01:19:11 CST

Original text of this message

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