Home » SQL & PL/SQL » SQL & PL/SQL » Time conversion
Time conversion [message #37146] Mon, 21 January 2002 05:08 Go to next message
Frederik
Messages: 8
Registered: December 2001
Junior Member
Hi!!
I was wondering if there´s a function with which I can convert a quantity of minutes into hours and minutes.
I.E: 330 --> 05:30
It doesn´t matter if it puts a date part in the result.
Thanx in adv.
Fred.-
Re: Time conversion [message #37147 is a reply to message #37146] Mon, 21 January 2002 05:59 Go to previous messageGo to next message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
Hi,

i do not think there is one.Try creating your own function.

cheers
pratap
Re: Time conversion [message #37150 is a reply to message #37146] Mon, 21 January 2002 07:54 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
CREATE OR REPLACE FUNCTION to_hms (i_days IN number)
   RETURN varchar2
IS
BEGIN
   RETURN TO_CHAR (TRUNC (i_days)) || ' days ' ||
		 TO_CHAR (TRUNC (SYSDATE) + MOD (i_days, 1), 'HH24:MI:SS');
END to_hms;
/

select to_date('17-Jan-2002 13:20:20', 'dd-Mon-yyyy hh24:mi:ss') - 
       to_date('11-Jan-2002 11:05:05', 'dd-Mon-yyyy hh24:mi:ss') from dual;			  

6.0939236111111111111111111111111111111

select to_hms(to_date('17-Jan-2002 13:20:20', 'dd-Mon-yyyy hh24:mi:ss') - 
       to_date('11-Jan-2002 11:05:05', 'dd-Mon-yyyy hh24:mi:ss')) from dual;			  

6 days 02:15:15

Previous Topic: Pragma Restrict References
Next Topic: how to find the sequence
Goto Forum:
  


Current Time: Mon Aug 02 10:22:47 CDT 2021