Convert seconds to hh:mm:ss

I need to convert seconds to hh:mm:ss.  For example, 5565 seconds would be displayed as 01:32:45.  Does anyone have a good way to do this?

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    Hope this helps

      local!hoursInDecimal: split(5565 / 3600, "."),
      local!minutes:split((todecimal("." & local!hoursInDecimal[2])*60),"."),
      joinarray({text(local!hoursInDecimal[1],"00"), text(local!minutes[1], "00"), text(round(("." & local!minutes[2])*60), "00")}, ":")
      /*time(local!hoursInDecimal[1], local!minutes[1] , round(("." & local!minutes[2])*60))*/

  • Conveniently you can also use Appian's  intervalds() function that converts the given time components into an equivalent time duration. Since you only have seconds, you can specify 0's for hour and minute values. e.g. intervalds(0,0,5565) will result 0::01:32:45.000. You can then apply specific formatting as needed. Code snippet be like -

    split(split(tostring(intervalds(0,0,5565)), "::")[2],".")[1]