Re: Date arithmetic with oracle

From: Singapore Airlines Ltd <engsys_at_merlion.singnet.com.sg>
Date: 1996/08/01
Message-ID: <4tpbir$1vd_at_lantana.singnet.com.sg>#1/1


Hi Erik,

date_b - date_a
gives you the number of days.

to do this both date_a, date_b must be of datatype DATE.

Once you get the number of days multiply with 24 to get number of hours.

Example :-

select add_months(sysdate, 1) - sysdate
from dual

will give you 31 days.

Hope this helps.

Ccheers.
Prasad

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.
 

: 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.
: --
  Received on Thu Aug 01 1996 - 00:00:00 CEST

Original text of this message