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

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

From: Ed Bradt <ebradt_at_lilly.com>
Date: 1997/08/12
Message-ID: <33F0A0B1.2A0F@lilly.com>#1/1

all you need to do is subtract the 2 dates, the result is in days: SQL> select to_date('3/2/97','mm/dd/yy')-to_date('2/1/97','mm/dd/yy') from dual;

TO_DATE('3/2/97','MM/DD/YY')-TO_DATE('2/1/97','MM/DD/YY')


                                                       29
Ed Bradt

Duncan Berriman wrote:
>
> Suggest you convert to Julian to_char(date,'J') and then subtract one from
> the other.
> Regards
> Duncan Berriman
>
> Huang, Joseph <huang_at_baptized.com.---> wrote in article
> <5rnq02$d28_at_bolivia.earthlink.net>...
> 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.
>
> Before writing our own function to get correct number of days, I'd like to
> know whether this kind of function exists somewhere so I don't need to redo
> it. Any suggestions?
>
> Thanks in advance.
>
> Joseph Huang
>
> --
> My email address is intentionally invalid to foil spammers. Delete the
> ".---" to get my real address.
>
> ----------
Received on Tue Aug 12 1997 - 00:00:00 CDT

Original text of this message

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