Re: Date arithmetic with oracle

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 1996/08/01
Message-ID: <32011d8d.27780125_at_dcsun4>#1/1


On Wed, 31 Jul 1996 16:26:37 -0700, Erik Johnson <ErikX_Johnson_at_ccm2.hf.intel.com> wrote:

>I need to calculate the number of hour between 2 dates. So if I had:
>
>date_a 7/31/96 10:10:10
>date_b 7/31/96 12:12:12
>
>date_b - date_a = 2 hrs.

This is the number of days between two dates. To get number of hours, multiply by 24. To get number of minutes take that and multiply by 60. And so on.

(date_b-date_a)*24 = 2hrs....

>
>How can I do this in a SQL statement with Oracle?? Just subtracting the
>dates gives me nothing. And I've tried messing with the different date
>functions and formats with no luck.
>
>Thanks in advance for any help.
>--

Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com                          

http://govt.us.oracle.com -- Check out our web site! Brand new, uses Oracle Web Server and Database


statements and opinions are mine and do not necessarily reflect the opinions of Oracle Corporation Received on Thu Aug 01 1996 - 00:00:00 CEST

Original text of this message