How to format seconds as integer into hh:mm:ss in presto?

by elise_daugherty , in category: Third Party Scripts , 5 months ago

How to format seconds as integer into hh:mm:ss in presto?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by dedrick , 5 months ago

@elise_daugherty 

To format seconds as an integer into hh:mm:ss in Presto, you can use the following query:

1
2
3
4
SELECT 
    CAST(seconds / 3600 AS VARCHAR) || ':' || CAST((seconds % 3600) / 60 AS VARCHAR) || ':' || CAST(seconds % 60 AS VARCHAR) AS formatted_time
FROM 
    your_table;


Replace your_table with the name of your table and seconds with the column containing the seconds you want to format. This query will convert the seconds into hours, minutes, and seconds format (hh:mm:ss).

Related Threads:

How to compare the seconds between two dates to an integer in oracle?
How to get current time in hh:mm:ss format using moment in react.js?
How to redirect after 5 seconds in PHP?
How to format a number as percentage with 2 decimal places in presto?
How to convert yyyy-mm-dd hh:mm:ss to hh:mm:ss in mysql?
How to group time column into 5 second intervals and count rows using presto?