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: How to calculate difference in time?

Re: How to calculate difference in time?

From: Andreas Vogler <vogler_at_etm.co.at>
Date: Mon, 21 Sep 1998 10:15:36 +0200
Message-ID: <36060b10.0@server02.bnet.at>


The difference between two dates is returned in day's as an integer. Oracle stores date's only down to seconds. So if you want the difference in seconds try this:

  dbms_output.put_line(to_char((date_Y - date_X) * 24 * 60 * 60));

Robert Chung schrieb in Nachricht <35eb009c.28919313_at_news.mindspring.com>...
>
>Does anyone know how to calculate difference in time? Following is
>something that I tried.
>
>declare
> date_X date;
> date_Y date;
>begin
> date_X:=SYSDATE;
>
> -- Do something. Spend some time
>
> date_Y:=SYSDATE;
> dbms_output.put_line(
> to_char(date_Y-date_X,
> 'MM:DD:YYYY HH24:MI:SS'));
>end;
>/
>
>Following is the output that I got.
>
>Statement processed.
>##########
>
>All I want is the difference in time (possibly to the micro second).
>Is there any way to do it? Thank you.
>
Received on Mon Sep 21 1998 - 03:15:36 CDT

Original text of this message

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