回答simple question我被问及如何“转换”2 days 31:09:34
到3 days 07:09:34
。我不能提出任何不那么丑陋的东西,然后再执行一次时差,就像这里:
t=# with a as (
select cast('2 days 31:09:34.607843' as interval) i
)
select i, now() +i -now() wheel,i+interval '1 minute'
from a;
i | wheel | ?column?
------------------------+------------------------+------------------------
2 days 31:09:34.607843 | 3 days 07:09:34.607843 | 2 days 31:10:34.607843
(1 row)
时间:0.232毫秒
请告诉我将'25 hours'::interval
“翻译”为'1 day 1 hour'::interval
答案 0 :(得分:1)
with a as (
select cast('2 days 31:09:34.607843' as interval) i
)
select justify_interval(i)
from a;
输出
justify_interval
------------------------
3 days 07:09:34.607843
(1 row)