How to subtract 2 dates in oracle to get the result in hour and minute

后端 未结 8 1904
深忆病人
深忆病人 2020-12-16 20:49

I want to subtract 2 dates and represent the result in hour and minute in one decimal figure.

I have the following table and I am doing it in this way but the result

8条回答
  •  醉话见心
    2020-12-16 21:17

    This query is very usefull for me and if any body want diffrence between start_date and end_date with time like HH:MI:SS please use this query.

    SELECT
        TRIM(TO_CHAR(TRUNC(((86400*(end_date - start_date))/60)/60)-24*(trunc((((86400(end_date - start_date))/60)/60)/24)),'00')) ||'.'||
        TRIM(TO_CHAR(TRUNC((86400*(actual_completion_date - actual_start_date))/60)-60*(trunc(((86400*(end_date - start_date))/60)/60)),'00')) ||'.'||
        TRIM(TO_CHAR(TRUNC((86400*(end_date - start_date)))-60*(trunc((86400*(end_date - actual_start_date))/60)),'00')) as duration  
    FROM fnd_concurrent_requests; 
    

提交回复
热议问题