Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: subtract dates
I use this code to convert the difference between to dates into date
format:
decode(trunc((a.event_time - b.event_time) * 24),0,
to_char(trunc((a.event_time - b.event_time) * 1440)), to_char(trunc((a.event_time - b.event_time) * 24)) || ':' || to_char(trunc((a.event_time - b.event_time) * 1440) - trunc((a.event_time - b.event_time) * 24) *60,'FM00'))
to_char(round(((a.event_time - b.event_time) * 1440 - trunc((a.event_time - b.event_time) * 1440)) *60),'FM00
It displays the time in the format of hours:minutes:seconds.
Scott Canaan (srcdco_at_rit.edu)
(585) 475-7886
"Life is like a sewer, what you get out of it depends on what you put
into it." - Tom Lehrer.
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Huascar Espinoza
Sent: Wednesday, May 12, 2004 11:16 AM
To: oracle-l_at_freelists.org
Subject: subtract dates
Hi guys: =3D20
=3D20
How can I subtract two dates ('DD/MM/YY HH:MI:SS') to obtain the result
=3D
in hours? MONTHS_BETWEEN don't obtain a precise value. =3D20
=3D20
Thank you,
Hu=3DE1scar
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html ----------------------------------------------------------------- ---------------------------------------------------------------- Please see the official ORACLE-L FAQ: http://www.orafaq.com ---------------------------------------------------------------- To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line. -- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Wed May 12 2004 - 10:29:59 CDT
![]() |
![]() |