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: ??? Number of days betwwen two dates?

Re: ??? Number of days betwwen two dates?

From: Lucy Cornelese <lcornele_at_caiw.nl>
Date: 1997/07/31
Message-ID: <33e03033.58790860@194.178.9.131>#1/1

> I need a function, which I can use in other stored procedures, to =
>return number of days of two given dates. The only similar function I =
>can found in Oracle manual is MONTHS_BETWEEN(). However, the problem is =
>MONTHs_BETWEEN() return number based on 31-day month which is incorrect =
>normally. For example, instead of 29 days, the function returns =
>1.0322581 (32 days) from 02/01/97 to 03/02/97.

try date1 - date2
This will give the exact number of days between the two dates.

If your using a non-default format-mask like 02/01/97:
to_date('03/02/97','DD/MM/YY') - to_date('02/01/97','DD/MM/YY')
you can of course use a variable instead of '03/02/97'

Lucy Received on Thu Jul 31 1997 - 00:00:00 CDT

Original text of this message

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