Dhugael McLean wrote:
> select '1 day'::interval - '55 minutes'::interval;
>
> ?column?
> -----------------
> 1 day -00:55:00
>
> If the interval periods are both minutes (hours - hours, days - days, etc),
> this works fine. Days - minutes seems to fail. This should output 23:05:00.
No, that answer would be wrong because not all days are 24 hours long
(think DST). You can use justify_hours() if you want to make that
assumption:
alvherre=# select justify_hours('1 day'::interval - '55 minutes'::interval);
justify_hours
---------------
23:05:00
(1 fila)
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.