I have a table as follows:
Filename - varchar
Creation Date - Date format dd/mm/yyyy hh24:mi:ss
Oldest cdr date - Date format dd/mm/yyyy hh24:mi:ss
How can I calcuate the difference in hours minutes and seconds (and possibly days) between the two dates in Oracle SQL?
Thanks
You may also try this:
It displays time in more human readable form, like: 00:01:34. If you need also days you may simply add DD to last formatting string.
Here's another option:
You could use to_timestamp function to convert the dates to timestamps and perform a substract operation.
Something like:
If you want something that looks a bit simpler, try this for finding events in a table which occurred in the past 1 minute:
With this entry you can fiddle with the decimal values till you get the minute value that you want. The value .0007 happens to be 1 minute as far as the sysdate significant digits are concerned. You can use multiples of that to get any other value that you want:
Result is 1 (minute)
Then it is a simple matter to check for
in oracle 11g
select end_date - start_date as day_diff from tablexxx suppose the starT_date end_date is define in the tablexxx
This will count time between to dates: