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: DATE column difference in minutes.

Re: DATE column difference in minutes.

From: Barry Schader <barry.schader_at_medtronic.com>
Date: 1997/05/22
Message-ID: <33851E64.860@medtronic.com>#1/1

Guna Govind wrote:
>
> Hi,
> posting this on behalf of my colleque..
>
> I'm using Oracle7.3 on Solaris 2.5.1.
> I need to calculate the time difference in minutes from 2 character
> strings (basically the timestamp is stored in a 'C' program
> as a charcter string). I tried to convert the character string
> to "date" format using "to_date", and subtracted them. But it always
> subtracts the date portion of the timestamp, but not the time.That is,
> if I subtract two different times on the same date, I always
> get '0'.
>
> Any help on this, is greatly appreciated.
>
> Regards,
> Meena

Sounds like you are on the right track. Be sure to include the time portion in the format string in your TO_DATE function call, then subtract.

When you subtract two DATE format items in Oracle, you get the number of days, expressed as a floating-point number, including any fraction of days. Avoid truncating the fractional part, and multiply by the number of minutes in a day to get your answer.

Received on Thu May 22 1997 - 00:00:00 CDT

Original text of this message

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