Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Cloud Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Cloud.
SOLVED

How to calculate a HH:MM:SS from a seconds column (integer) ?

Marc-LEVIN
8 - Asteroid

Hello,

 

I have a column with the number of seconds. Each rows have an integer (number of seconds) :

 

Sec

21

175

1652

71

102

 

I want to obtain a column with the traduction of this value in this format : HH:MM:SS

Is there a function to do this ? I've not found in the documentation...

 

Many thanks ! 🙂

 

2 REPLIES 2
Trifacta_Alumni
Alteryx Alumni (Retired)

There is no built in function for this. You can however accomplish this with a recipe step. I have attached a macro that contains this recipe step to accomplish this. The code for it is:

 

MERGE([PAD(FLOOR(DIVIDE(seconds, 3600)), 2, '0', left),PAD(FLOOR(MOD(seconds, 3600) / 60), 2, '0', left),PAD(MOD(seconds, 60), 2, '0', left)], ':')

 

where seconds is the column containing the seconds.

Marc-LEVIN
8 - Asteroid

Hi @Eric Thomas? ,

 

Your solution is perfect ! 👍

Thank you !