I’m trying to convert mile times from seconds to minutes and seconds but I’m struggling. For example, if an individual’s mile time is 263.74 seconds, but I cant figure out how can I convert it so it shows 4:23.74 on the front end.
I’ve tried dividing the seconds by 60 and then taking the floor for the first minutes factor (263.74/60 = 4.395 --> floor = 4). And then I’ve tried subtracting the total seconds by the floor value * 60 (263.74-240 = 23.74) but this does not work.
This is the goal:
This is what I have. Not sure why this is an error/complicated:
Any help would be greatly appreciated!
i would suggest using the toolbox expression and moment.js with moment.duration(YOURVALUE, “seconds”).format(“hh:mm:ss”);
Hi there, @timothybrennan2… I’m sure Bubbleboy’s solution is a better way to go, but why not just continue down the path you are on by calculating the leftover seconds in a field and then putting the minutes and leftover seconds together in a new field?
Hey Mike! This is actually exactly what I was trying to do initially. I tried to use formulas to take mile time in seconds to minutes, seconds and total seconds to get to mm:ss.ms
Can you take a look at this and see what I missed? Any help would be very very much appreciated.
Thank you so much! I think this would get me exactly where I want to get to in the end. I’ve never used the toolbox expression or moment.js before. Are there any resources you would suggest to learn how to use this tools well? Again any help is very much appreciated!
Check it now, @timothybrennan2… do you see the desired result (it looks good to me)? Some of your input fields were set to text when they needed to be integer or decimal, and you had formulas in the
Placeholder fields when they need to be in the
Initial content fields.
You just need the modulo operator…
Here’s an example (edit mode link in upper right).
Yes that is exactly what I was looking for. Thank you so much Mike! Learned a ton from your help and example
This topic was automatically closed after 70 days. New replies are no longer allowed.