# How to convert decimal hours to time format in Bubble

How can I do this in Bubble using the standard Bubble number functions?

Convert 2.88 hours to hh:mm:ss

• 2.88 hours can be broken down to 2 hours plus 0.88 hours - 2 hours
• 0.88 hours * 60 minutes/hour = 52.8 minutes - 52 minutes
• 0.8 minutes * 60 seconds/minute = 48 seconds - 48 seconds
• 02:52:48

2.88 *3600 = X seconds

HH = 2.88:floor or :roundedto0
MM = (X/60):floor or :roundedto0, or (2.88-HH)*60:floor
SS = if (X<-modulo->60) <10, 0:amend(x<-modulo->60), else (x<-modulo->60),

HH::amend"MM":amend":":amend"SS"

Maybe something like this?

1 Like

So for the MM formula, this is what I got for some reason:

Hereâ€™s the formula:

Also, how do I set up / access the if, amend, and else functions?

Iâ€™ve actually never seen these before in Bubble - is this a plugin?

Ahh, I guess itâ€™s actually, ((X/60)<-modulo-> 60):floor for minutes. and ((X/60)<-modulo-> 60)<-modulo->60):floor for seconds. Thereâ€™s an extra <-modulo-> to remove the whole numbers.

The :amend, is a function to attach text to text response. So you need to be working with text.

The â€śelseâ€ť is not a function, I was using that for shorthand that you donâ€™t need an additional condition.

This topic was automatically closed after 70 days. New replies are no longer allowed.