0

In oracle Query How can I get difference between two dates format like HH:MI:SS?

There are two dates with timestamp format like 'DD/MM/YYYY HH:MI:SS' How can I get difference between these two dates like HH:MI:SS?

Example:

Date1= '15/11/2015 11:19:58'
Date2= '14/11/2015 10:20:58'


Output:25:01:00 (HH:MI:SS)

I tried below query

select to_char(('15/11/2015 11:19:58'-'14/11/2015 10:20:58'),'HH24:MI:SS') 
from dual;

I’m getting below output:

+000000001 01:01:000

But I want this format 25:01:00 (HH:MI:SS)

Kaushik Nayak
  • 30,772
  • 5
  • 32
  • 45
suri
  • 1
  • 4
  • Duplicate of [Oracle: Calculate time difference in HH:MM:SS between 2 dates](https://stackoverflow.com/questions/20867220/oracle-calculate-time-difference-in-hhmmss-between-2-dates) – Kaushik Nayak May 17 '18 at 15:23
  • Your query is invalid as you're trying to subtract string not dates; and the output you showed is an interval, suggesting you've subtracted two timestamps. not dates? [This might help?](https://stackoverflow.com/a/45601629/266304) – Alex Poole May 17 '18 at 15:33

0 Answers0