9 Replies Latest reply on Jul 26, 2018 11:15 AM by Matthew Maling

Convert Decimal to HH:MM:SS

Hey,

I am trying to format a number in to HH:MM:SS.

The number is 2.33 and it should be reading 2:20:22.

Just by adjusting the format is making this 8:00:00.

I need to know if there is way to convert a decimal where the hour is before the decimal and the minutes and seconds are represented after the decimal.

Thanks!

• 1. Re: Convert Decimal to HH:MM:SS

The number is 2.33 and it should be reading 2:20:22.

how 33 is 20:22?

• 2. Re: Convert Decimal to HH:MM:SS

Hi, Matthew

You can actually use the format to achieve that.

Below is an example of using 2.33

Hope this helps

ZZ

1 of 1 people found this helpful
• 3. Re: Convert Decimal to HH:MM:SS

So the post directly below this actually solved this issue. I believe the .33 was a percentage within the hour representing 20 minutes and 22 seconds.

• 4. Re: Convert Decimal to HH:MM:SS

Okay wait, this seems to solve the issue for the 2.33 but the other numbers are off. I followed your steps but replaced the 2.33 with the measure in the formula. When its any other number occurrence this is not working. Just for the 2.33 it is.

• 5. Re: Convert Decimal to HH:MM:SS

Hi

Find my approach,

[Time]: 2.33

First convert this to datetime

DATETIME([Time]/86400)

Then set the default format like this

Hope this will help.

Mahfooj

• 6. Re: Convert Decimal to HH:MM:SS

After reading that article I think I might see what the issue may be. Along with the 2.33 I also have numbers that will represent greater than 24 hours. It seems your method works great for all my numbers 24 hours or less.

• 7. Re: Convert Decimal to HH:MM:SS

Hello Matthew,

I have written a detailed post for the issue you are facing.
Here it is Tableau Tips: Datetime difference in the format DD:HH:MM:SS – Data Vizzes

Hope this helps
Thanks
Rahul

• 8. Re: Convert Decimal to HH:MM:SS

If you've got your expected solution then you may close the thread by marking my answer as correct so that it gets hide from unanswered list and help others who've similar question.

• 9. Re: Convert Decimal to HH:MM:SS

This is not fully solved. All numbers representing a time 24 hours and less your method works. But for my numbers that represent greater then 24  hours, this method does not work. Its stops at 24 hours and re counts from the beginning, 25=1 26=2 and so on. I need a solution to be able to go beyond 24 hours.