Convert seconds to HH:MM:SS PostgreSQL
Here’s how to convert a numeric integer field of seconds to HH:MM:SS. Use the INTERVAL PostgreSQL data type. The INTERVAL data type is used to store and manipulate a time period. Example SELECT 120 * interval '1 sec'; Output |120 seconds to HH:MM:SS| |-----------------------| |00:02:00| An example with a table of rows of call records that have the length of call in seconds in a column called duration. select duration , duration * interval '1 sec' seconds_to_hh_mm_ss , duration * interval '1 min' min_to_hh_mm_ss from calls; Output...