We have extended our Early Bird Tickets for Inspire 2023! Discounted pricing goes until February 24th. Save your spot!

alteryx Community

# Alteryx Designer Discussions

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

## Converting seconds to hh:mm:ss

6 - Meteoroid

Hi All,

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

Thanks

5 REPLIES 5
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

15 - Aurora

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")

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.

6 - Meteoroid

thank you both, will try this out.

6 - Meteoroid

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

Labels