Formatting time duration

Hey folks… it feels like this should be easy but I just can’t figure it out. My database is feeding song durations into the app formatted in seconds (so if the song is 2:53 it is showing up as 173), and all I want to do is format it to show up as minutes:seconds.

I have been messing around with the FORMAT_DATETIME and I just can’t figure out how to make it work properly.

Little help?

Hi,
I think you have to do the calculation in the logical canvas.
Create 3 variables : Hours, minutes and seconds
var hrs ==(duration / 3600);
var mins = (var hrs / 60);
var secs = (var secs % 60)

Output like “4:03:59”
var hrs+“:“var mins+”:”+var secs

Maybe there is another solution but I don’t know it.

You know, it occurred to me to do something similar to this but then thought there had to be a simpler way. Alas, ‘simple’ doesn’t seem to be Appgyver’s differentiator :_)

Thank you for this. I will give it a try and report back.

This is not an appgyver problem. In code, this is the logic I will have done.