开发者

oracle SUBSTR date duration

开发者 https://www.devze.com 2022-12-16 09:32 出处:网络
when i do query SUBSTR(e.updatetime - s.updatetime, 1,30) i will get result below +000000001 05:06:47.388000

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...

开发者_如何学Python

p/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"
0

精彩评论

暂无评论...
验证码 换一张
取 消