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

后端 未结 8 1891
深忆病人
深忆病人 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:29

    try this:

        SELECT
        TRIM(TO_CHAR(TRUNC(((86400*(end_time - start_time))/60)/60)-24*(trunc((((86400*(end_time - start_time))/60)/60)/24)),'00')) ||'.'||
        TRIM(TO_CHAR(TRUNC((86400*(end_time - start_time))/60)-60*(trunc(((86400*(end_time - start_time))/60)/60)),'00')) ||'.'  as duration
    FROM come_leav;
    

提交回复
热议问题