开发者

How do I show hours instead of days for an interval in PostgreSQL?

One of my queries is returning the below interval. Istead of showing 6 days, I would like to sho开发者_StackOverfloww 6 x 24 + 19 hours. I would rather not convert to epoch using the extract (epoch from ...) operator. Is there a quick an easy way to do it?

 usage_minus_lost_data_gaps_and_battery_charge 
-----------------------------------------------
 6 days 19:18:21
(1 row)


Something like this could probably help:

# select to_char('6 days 19:18:21'::interval, 'DD x 24 + HH24 hours');
      to_char       
--------------------
 06 x 24 + 19 hours
(1 row)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜