ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
RÉSOLU

Converting seconds to hh:mm:ss

seelan89
Météoroïde

Hi All,

 

I am trying to convert seconds from an integer format into HH:MM:SS. Any suggestions?

 

Thanks

5 RÉPONSES 5
jdunkerley79
ACE Emeritus
ACE Emeritus

Assuming less than 24 hours. I suggest a formula tool creating a Time column:

DateTimeAdd("1900-01-01",[seconds],"seconds")

 

To cope with more than that I suggest. Same formula producing a DateTime as a string. Then a second formula step getting days difference and adding to hours. 

PadLeft(ToString(
DateTimeDiff([Time],"1900-01-01","days")*24
+ ToNumber(Substring([Time],11,2))
), 2,"0") 
+ Substring([Time],13,8)

Sample attached

LordNeilLord
Aurore

Or you can do:

 

PadLeft(ToString(Mod([Seconds]/3600,3600)),2,"0")+":"+

PadLeft(ToString(Mod([Seconds]/60,60)),2,"0")+":"+

PadLeft(ToString(Mod([Seconds],60)),2,"0")

 

jdunkerley79
ACE Emeritus
ACE Emeritus

Merge the two :)

PadLeft(ToString(Floor([Seconds]/3600)),2,"0") +
Right(DateTimeAdd("1900-01-01",[seconds],"seconds"),6)

Should work for all time periods.

seelan89
Météoroïde

thank you both, will try this out.

 

swilson9
Météoroïde

Hi all, 

 

I have tried to convert a time int32 (seconds) into hh:mm:ss  where the record as follows 

 

Records    Sum_TimeTaken 

1                10068859

 

How do i convert this time which is in seconds (int32) into hh:mm:ss 

 

 

Étiquettes
Auteurs des meilleures solutions