snippetModerate
How do I get the difference in minutes from 2 timestamp columns?
Viewed 0 times
thetimestampcolumnsdifferencegethowminutesfrom
Problem
Can't seem to figure this out. Just need the difference in minutes between 2 oracle timestamp columns.
END_TS START_TS
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
11-NOV-13 01.52.14.000000 PM 11-NOV-13 01.51.14.000000 PM
11-NOV-13 02.20.47.000000 PM 11-NOV-13 02.19.47.000000 PM
18-NOV-13 12.44.54.000000 PM 18-NOV-13 12.34.02.000000 PM
22-NOV-13 12.02.09.000000 AM 22-NOV-13 12.02.08.000000 AMSolution
select
round(
(cast(current_timestamp as date) - cast( as date))
* 24 * 60
) as diff_minutes
from ;This is what I used to calculate the difference between the current timestamp and a heart beat table entry for latency monitoring.
Code Snippets
select
round(
(cast(current_timestamp as date) - cast(<other_timestamp> as date))
* 24 * 60
) as diff_minutes
from <some_table>;Context
StackExchange Database Administrators Q#53924, answer score: 14
Revisions (0)
No revisions yet.