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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Question on subtracting timestamps

Re: Question on subtracting timestamps

From: Dave Fowler <d.fowler_at_smmj.com>
Date: Mon, 23 Apr 2001 22:35:08 GMT
Message-ID: <w62F6.3405$5t3.270267@newsread1.prod.itd.earthlink.net>

Amanda,
If they are date fields otherwise to_date() them.   select (wo_closed_time - arrival_time) from dual. This is a real number in days between the values.
Multiple this by however you want to show it hours minutes seconds based on number of those in a day.
eg. 60*60*24 seconds /day.
I haven't tried this but
SELECT

 TRUNC((wo_closed_time - arrival_time)) ||' days, '
 ||Mod(TRUNC(((wo_closed_time - arrival_time) )*24),24) || ' hours, '
 ||Mod( trunc(((wo_closed_time - arrival_time) )* 24*60),60) || ' minutes
 and '
 ||mod( TRUNC(((wo_closed_time - arrival_time) )* 24*60*60) ,60) || ' seconds.'

from your_table where....

"Amanda Zaborowski" <azaborow_at_mindspring.com> wrote in message news:9c1juc$v48$1_at_slb5.atl.mindspring.net...
> I am trying to subtract the arrival date/time of an employee from the
> date/time a work order is closed in order to obtain the length of time the
> work took to complete. Can someone help with the correct format for this?
>
> Example:
>
> arrival_time = '31-JAN-2000 23:11:09'
> wo_closed_time = '1-FEB-2000 01:29:00'
> repair_time = ?
>
> Thanks so much in advance for your help. It is greatly appreciated!
>
>
Received on Mon Apr 23 2001 - 17:35:08 CDT

Original text of this message

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