oracle SUBSTR date duration
when i do query SUBSTR(e.updatetime - s.updatetime, 1,30) i will get result below +000000001 05:06:47.388000
can this save in java.util.Date? or which java class should i use other than String to ease me retrieve day,minutes,hours...
开发者_如何学Pythonp/s: e.updatetime is timestamp type
Start with the separate fields, then join them up as you want.
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 ....;
this snippet might be helpful too:
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"
精彩评论