Re: Difference between Times

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 1996/10/04
Message-ID: <325465dc.2425217_at_dcsun4>#1/1


say a and b are dates...

hours between = trunc((a-b)*24)
minutes between = trunc((a-b)*24*60)

to get hours/minutes between you would:

A          B                  HR        MIN
---------- ---------- ---------- ----------
21:17      17:52               3         24
 

SQL> l
  1 select to_char(a,'hh24:mi') a, to_char(b,'hh24:mi') b,   2* trunc((a-b)*24) hr, mod(trunc((a-b)*24*60),60) min from dates SQL> On Thu, 03 Oct 1996 19:52:40 -0400, Ed Jennings <jennings_at_dca.net> wrote:

>I know that by subtracting two dates I can get an integer that
>represents the number of days bewteen the tow dates.
>However, I need a solution that is more granular.
>Does anyone know how to get the difference between two date
>types in hours & minutes? The times of two events are
>being stored in date format columns. I need to compute the time
>between the two events.
>--
>~~~~~~~~~~~~~~~~~~~~~~~~~
>jennings_at_dca.net

Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com                          

http://govt.us.oracle.com

  • Check out Oracle Governments web site! ----- Follow the link to "Tech Center" and then downloadable Utilities for some free software...

statements and opinions are mine and do not necessarily reflect the opinions of Oracle Corporation Received on Fri Oct 04 1996 - 00:00:00 CEST

Original text of this message