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

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

    Try this

    round(to_number(end_time - start_time) * 24)
    
    0 讨论(0)
  • 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;
    
    0 讨论(0)
提交回复
热议问题