Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: ??? Number of days betwwen two dates?
> 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
![]() |
![]() |