6 Replies Latest reply on Jun 6, 2019 2:24 PM by Cynthia Derksen

# Seconds to hh:mm:ss calc

I looked up an older post on how to convert seconds to hh:mm:ss format and it works for smaller numbers, but not larger numbers.

The calc took the metric, copied it, divided by 86400.  Then changes the default number format to custom, and set to hh:mm:ss

It seems to work, but when it gets to large numbers (>100,000 seconds) it is not accurate.  Is there some modification needed?

• ###### 1. Re: Seconds to hh:mm:ss calc

Hi Ben,

You'll likely need to use Jonathan Drummey's calculation work to make this modification.  Attached is a 2018.2 workbook and below are the screenshots. Here's the link to his method: Formatting Time Durations in Tableau | Drawing with Numbers

I set the [Seconds] to be a measure:

Then a new calculation to SUM the Seconds:

Then JD's calculation to bring it to d:hh:mm:ss and the formatting is custom to: 0:00:00:00 instead of d:hh:mm:ss

Hope this helps! Thx, Don

1 of 1 people found this helpful
• ###### 2. Re: Seconds to hh:mm:ss calc

Thanks Don! This does work, the only downside is that it doesn't seem to like the very large numbers to be displayed in just hours instead of days.  For example, 346,027 seconds displays accurately in terms of 4 days, but if I remove the 00 from this, it displays as 400:07:07 instead of 96 hours.  Is this a limit of the calc or is there any other way to add it to total hours?

• ###### 3. Re: Seconds to hh:mm:ss calc

Hi Ben,

No worries...I'd thought you wanted hours greater than 24 hours displayed as DD:

The modified calculation and attached workbook now sums to total HH:mm:ss.  In the previous example there were 4 days (4*24=96) and 16 hours already displayed in the sum as a remainder.  So the total of 96+16=112 hours.

Hope it resolves your concern! Thanks, Don

2 of 2 people found this helpful
• ###### 4. Re: Seconds to hh:mm:ss calc

Yep that's it! Thank you!

• ###### 6. Re: Seconds to hh:mm:ss calc

This has answered my question too.  Thank you!!