Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Time function?

Re: Time function?

From: <smb_slb_at_my-dejanews.com>
Date: Mon, 24 May 1999 19:37:52 GMT
Message-ID: <7ic9qg$et4$1@nnrp1.deja.com>


Here you go:

create or replace procedure TimeDiff
 (FirstDate IN date

 ,SecondDate IN date
 ,Hours OUT number
 ,Minutes OUT number
 ,Seconds OUT number)

 AS
BEGIN
  DECLARE
    TotalSeconds number;
BEGIN
  TotalSeconds := (SecondDate - FirstDate) * 86400;
  Seconds := mod(TotalSeconds, 60);
  Minutes := mod(TotalSeconds - Seconds, 3600) / 60;
  Hours := floor(TotalSeconds / 3600);

END; END;
/

In article <7ic6vl$cu1$1_at_nnrp1.deja.com>,   grider22_at_my-dejanews.com wrote:
> Hi,
>
> Does anyone know of a function or how to create one that will take in
> two different time values and return the difference in hours, minutes
> and seconds as separate variables.
>
> Thanks
> Stephen
>
> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---
>

--== Sent via Deja.com http://www.deja.com/ ==-- ---Share what you know. Learn what you don't.--- Received on Mon May 24 1999 - 14:37:52 CDT

Original text of this message

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