Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Question on subtracting timestamps
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) || ' minutesand '
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
![]() |
![]() |