当我查询SUBSTR(e.updatetime - s.updatetime,1,30)时,我会得到以下结果 +000000001 05:06:47.388000
这可以保存在java.util.Date中吗?或者我应该使用除String之外的哪个java类来简化我检索日,分,小时......
p / s:e.updatetime是时间戳类型
答案 0 :(得分:3)
从单独的字段开始,然后根据需要将它们连接起来。
select extract (day from (time_b-time_a)),
extract (hour from (time_b-time_a)),
extract (minute from (time_b-time_a)),
extract (second from (time_b-time_a))
from ....;
答案 1 :(得分:1)
此代码段也可能有用:
select ...,
extract (day from (j.finished_date - j.started_date)) * 86000 +
extract (hour from (j.finished_date - j.started_date)) * 3600 +
extract (minute from (j.finished_date - j.started_date)) * 60 +
extract (second from (j.finished_date - j.started_date)) as "duration"