Postgresql: "Offset" Interval from HH:MM:SS to 00:HH:MM Postgresql: "Offset" Interval from HH:MM:SS to 00:HH:MM postgresql postgresql

Postgresql: "Offset" Interval from HH:MM:SS to 00:HH:MM


SELECT EXTRACT(hour FROM duration) * INTERVAL '1' minute + EXTRACT(minute FROM duration) * INTERVAL '1' secondFROM tbl;

EDIT

This was my original answer, which does not answer the original question:

You can try something like this:

SELECT duration - EXTRACT(hour FROM duration) * INTERVAL '1' hourFROM tbl;

Which extracts the hour part from the interval and subtracts that from the original value. Rewrite as UPDATE if you really need to update your data.