我从此查询中获取分钟数
(SELECT (X_GSA_LEAVE_SITE - X_GSA_ARRIVE_ONSITE) * 24 * 60 AS difference_in_minutes
FROM table_x_gsa_time_stamps
WHERE X_TIME_STAMPS2X_DISPTCHFE = dfe.objid and rownum=1) Adj_Handle_time,
我需要hh:mm格式..我该如何实现
答案 0 :(得分:0)
尝试一下:
SELECT TRUNC(((X_GSA_LEAVE_SITE - X_GSA_ARRIVE_ONSITE) * 24 * 60)/60) || ':' ||
(((X_GSA_LEAVE_SITE - X_GSA_ARRIVE_ONSITE) * 24 * 60)
- TRUNC(((X_GSA_LEAVE_SITE - X_GSA_ARRIVE_ONSITE) * 24 * 60)/60)*60)
FROM table_x_gsa_time_stamps
WHERE X_TIME_STAMPS2X_DISPTCHFE = dfe.objid
and rownum=1
答案 1 :(得分:0)
稍微简化的版本:
select x_gsa_arrive_onsite
, x_gsa_leave_site
, trunc((x_gsa_leave_site - x_gsa_arrive_onsite) * 24) ||':'||
trunc(mod((x_gsa_leave_site - x_gsa_arrive_onsite) * 24 * 60, 60)) as onsite_hhmi
from table_x_gsa_time_stamps ts;
给予
X_GSA_ARRIVE_ONSITE X_GSA_LEAVE_SITE ONSITE_HHMI
------------------- ------------------ -----------
01-SEP-2018 01-SEP-2018 12:34 12:34
01-SEP-2018 02-SEP-2018 01:23 25:23