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: Best way to convert seconds to hours:minutes:seconds

Re: Best way to convert seconds to hours:minutes:seconds

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Fri, 29 Dec 2006 22:35:57 +0100
Message-ID: <45958a3e$0$291$426a74cc@news.free.fr>

<b_addams_at_yahoo.com> a écrit dans le message de news: 1167426986.041232.240990_at_48g2000cwx.googlegroups.com...
|I have a table that stores elapsed seconds as a numeric value. There is
| a PHP script that displays data from this table onto a web page. What
| is the best way to display the elapsed time in an HH:MI:SS format?
| Obviously the to_char function only works on dates, so I am not sure
| how to go about this. Do I need to create an internal PL/SQL function
| that is called from my PHP SQL?
|
| Thanks.
|

If your elapsed time does not exceed 24 hours (86400 seconds) you can use (with elapsed=81202 seconds):

SQL> select to_char(to_date(81202,'SSSSS'),'HH24:MI:SS') elapsed from dual; ELAPSED



22:33:22

1 row selected.

Regards
Michel Cadot Received on Fri Dec 29 2006 - 15:35:57 CST

Original text of this message

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