Re: Anyone have a DAYS_BETWEEN function?

From: Mike Daniell <mike_at_helix.com.au>
Date: Tue, 09 Mar 1999 12:42:16 +1000
Message-ID: <36E48A88.2C2D6F24_at_helix.com.au>


Steve Cosner wrote:
>
> In article <7bi9k4$2lr$1_at_nnrp1.dejanews.com>,
> <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.
>
> Look up Date Arithmetic in your Oracle SQL Reference manual. Just
> subtracting two dates gives you the number of days between the two.

Remember to truncate the two date fields if they may contain time components, eg
  days_between := TRUNC(date_to) - TRUNC(date_from);

Mike Received on Tue Mar 09 1999 - 03:42:16 CET

Original text of this message