Does anyone know if there is a way to convert a known length of time (in this case the number of minutes estimated for a sewer overflow) to hours, minutes, and seconds? Currently I am displaying the number of minutes (stored in a double field in a feature service) as an indicator in my dashboard. Any suggestions would be greatly appreciated.
You can use the built in value conversion in an indicator.
If that 50 represented minutes, converting it to hours would be as simple as applying a factor of 1/60, or .01666, and the result is now in hours.
Thanks Josh, that's better than showing minutes. Any thoughts on how to represent the hours and seconds? I'm thinking there is probably some kind of arcade expression that could be written.
Ah, you mean like "2 hours, 26 minutes, 15 seconds". That would have to be an arcade expression. For an example, I'll use 137.9 minutes. This is using a feature-based indicator with Arcade enabled.
var dur = $datapoint['duration-field'] // 137.9 used for test
var s = (dur * 60) % 60
var m = Floor(dur) % 60
var h = (Floor(dur) - m) / 60
return {
topText: `${dur} minutes`,
topTextMaxSize: 'medium',
middleText: `${h} hours, ${m} minutes, ${s} seconds`,
middleTextMaxSize: 'large'
}
Which results in:
Thanks Josh, that was exactly what I was looking for! I appreciate your time and effort on this!