Question

One of my queries is returning the below interval. Istead of showing 6 days, I would like to show 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)
Was it helpful?

Solution

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)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top