You can translate the question and the replies:

Convert time in seconds to time format HH:MM:SS

Hello, I have a field that contains the time in seconds, type int. And I need to represent it in the final view as time. So for example: **54107** should be 15 hours 1 minute and 40 seconds, or **15:01:40** in the final view. Is there any easy way to do it, some built-in converter/function etc.? thanks Masha
VQL
user
10-08-2022 04:26:22 -0400
code

2 Answers

Hello, I was able to convert seconds into a timestamp by following these steps: * Download and [**Install Denodo Xtrafuncs**](https://search.denodo.com/community/results?filter=Xtrafuncs+for+VDP&option=resources) so you can use the **LEFTPAD** function; * Use the query as follows: ``` select concat(seconds/3600, ':', LEFTPAD(((seconds%3600)/60),2,'0'),':', LEFTPAD((seconds%60),2,'0')) from (select 54107 as seconds) ``` The final result for 54107 seconds is **15:01:47**. Note that the LEFTPAD function is used here so that a 0 is added when the time calculation finishes with a single decimal value. Without this, the result would be 15:1:47. Hope this helps!
Denodo Team
10-08-2022 13:06:03 -0400
code
Great, thank you so much, it helped!
user
11-08-2022 04:38:27 -0400
You must sign in to add an answer. If you do not have an account, you can register here