Thursday, August 27, 2015

Calculate time difference between timestamps in milliseconds

Used the below sql to calculate the difference in timestamps in milliseconds.

select TX_ID,
       extract(hour   from (END_TIMESTAMP - START_TIMESTAMP)) * 3600000
        + extract(minute from (END_TIMESTAMP - START_TIMESTAMP)) * 60000
        + extract(second from (END_TIMESTAMP - START_TIMESTAMP)) * 1000 diff_im_ms
from t_transaction
where TX_ID IN (6587728628,6587728639,6587728647);





167

No comments:

Post a Comment