Sajid:

Try this piece. I use a version of it for my uptime.sql script:

TO_CHAR(TRUNC(date1 - date2)) || ' day(s), ' || TO_CHAR(TRUNC(MOD(date1
- date2 - 1, 1) * 24)) || ' hour(s), ' || TO_CHAR(TRUNC(((MOD(date1
- date2 - 1, 1) * 24) - (TRUNC(MOD(date1 - date2 - 1, 1) * 24)))
* 60)) || ' minute(s) and ' || TO_CHAR(ROUND(MOD(((MOD(date1
- date2 - 1, 1) * 24) - (TRUNC(MOD(date1 - date2 - 1, 1) * 24)))
* 60, 1) * 60, 1)) || ' seconds.'

--

Jon Walthour, OCDBA
Oracle DBA
Computer Horizons
Cincinnati, Ohio

>--- Original Message ---
>From: Sajid Iqbal <[EMAIL PROTECTED]>
>To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]>
>Date: 7/10/01 9:26:09 AM
>

>Hello All
>
>I want to display the "time elapsed" between two dates - in
days, hours,
>minutes and seconds.
>
>If I do "select date1 - date2", the result is : 12.0194907
>
>Is there a function that will turn the number of days into something
more
>legible?  Ideally i'd like to do ;
>
>"to_char(12.0194907,'DD:HH:MI:SS')" but obviously that won't
work.  Is
>there a solution other than writing a complex function myself
which will
>have to * by 24, / by 60 and substr etc to get the different
bits of the
>number?
>
>Please CC any replies directly to me at [EMAIL PROTECTED]
>
>Thanks in advance,
>Saj.
>
>
>
>-- 
>Sajid Iqbal
>Database Team Leader
>
>
>
>-- 
>Please see the official ORACLE-L FAQ: http://www.orafaq.com
>-- 
>Author: Sajid Iqbal
>  INET: [EMAIL PROTECTED]
>
>Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
>San Diego, California        -- Public Internet access / Mailing
Lists
>--------------------------------------------------------------------
>To REMOVE yourself from this mailing list, send an E-Mail message
>to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru')
and in
>the message BODY, include a line containing: UNSUB ORACLE-L
>(or the name of mailing list you want to be removed from). 
You may
>also send the HELP command for other information (like subscribing).
>


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jon Walthour
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to