# Convert Decimal hours

• Jun 28th 2006, 11:46 PM
psylencer
Convert Decimal hours (on computer)
K, I can do it on paper but how do I get a peice of software like excel
to convert 1.3 hours to 1hr 18min or 01:18?

Any help?
• Jun 29th 2006, 01:36 AM
Rich B.
Hi:

Given input hours=h,

h hrs = floor(h) hrs, 60*(h-floor(h)) min.

Ex.: input: h=1.3
flr(h)=flr(1.3)=1
60*(h-floor(h)) = 60*(1.3 - 1) = 60*0.3 = 18.

Output: 1.3 hrs = 1hr, 18 min.

Notes: (h-floor(h)) is just the "fractional" component, 0.3 in the given example. Substitutions are, therefore, frac(h) and (60*h)mod(60). Similarly, viable substitutions for flr(h) are, h-frac(h), h-(60*h)mod(60).

These things said, the algorithm in black becomes,

h hrs = flr(h) hrs, 60*(frac(h)) min.

Regards,

Rich B.
• Jun 29th 2006, 01:45 AM
syrivaci
Hi
Quote:

Originally Posted by psylencer
K, I can do it on paper but how do I get a peice of software like excel
to convert 1.3 hours to 1hr 18min or 01:18?

Any help?

I do not think it would be possible to place the value 1 and 18 in the same box but I am certain I have a method where they can be placed in side to side boxes e.g 1 in one box and 18 in the next box on the right hand side.

Let me know if this fulfils your requirements.
No doubt someon else will have a better method. :)
• Jun 29th 2006, 04:15 AM
JakeD
Quote:

Originally Posted by syrivaci
I do not think it would be possible to place the value 1 and 18 in the same box but I am certain I have a method where they can be placed in side to side boxes e.g 1 in one box and 18 in the next box on the right hand side.

Let me know if this fulfils your requirements.
No doubt someon else will have a better method. :)

The TIME function can be used to put the 1 and 18 into a time value. Then that value can be formatted to produce 01:18. :)
• Jun 29th 2006, 04:28 AM
syrivaci
Hehe
Quote:

Originally Posted by JakeD
The TIME function can be used to put the 1 and 18 into a time value. Then that value can be formatted to produce 01:18. :)

I told you someone would come up with a way. :)
I have a feeling some people on this forum are related to Einstein :rolleyes: :D
• Jun 29th 2006, 01:39 PM
psylencer
Quote:

Originally Posted by syrivaci
I do not think it would be possible to place the value 1 and 18 in the same box but I am certain I have a method where they can be placed in side to side boxes e.g 1 in one box and 18 in the next box on the right hand side.

Let me know if this fulfils your requirements.
No doubt someon else will have a better method. :)

This would be perferct. Let it be known that excell has an fuction to convert decimal time to Hrs:Min,Secs , but only in 12, or 24 hrs I need some maths to convert 65.3 to 65hrs 18mins.
• Jun 29th 2006, 01:52 PM
Quick
Quote:

Originally Posted by psylencer
This would be perferct. Let it be known that excell has an fuction to convert decimal time to Hrs:Min,Secs , but only in 12, or 24 hrs I need some maths to convert 65.3 to 65hrs 18mins.

Use this one then. (type the number you want to change in the blue box, ONLY TYPE A NUMBER!)
• Jun 29th 2006, 02:27 PM
psylencer
Quote:

Originally Posted by Rich B.
Hi:

Given input hours=h,

h hrs = floor(h) hrs, 60*(h-floor(h)) min.

Ex.: input: h=1.3
flr(h)=flr(1.3)=1
60*(h-floor(h)) = 60*(1.3 - 1) = 60*0.3 = 18.

Output: 1.3 hrs = 1hr, 18 min.

Notes: (h-floor(h)) is just the "fractional" component, 0.3 in the given example. Substitutions are, therefore, frac(h) and (60*h)mod(60). Similarly, viable substitutions for flr(h) are, h-frac(h), h-(60*h)mod(60).

These things said, the algorithm in black becomes,

h hrs = flr(h) hrs, 60*(frac(h)) min.

Regards,

Rich B.

Excellent work mate! Floor works well. Thanks Heaps. I love nerds!
• Jul 1st 2006, 01:43 AM
Rich B.
Hi Psylencer:

I am happy to have helped. In all honesty, my programing knowledge is limited. Nonetheless, I am indeed geek enough to help out with the algorithm stuff :). In the words of Hewey Lewis, "It's hip to be square" (octagonal is pretty cool too).

Enjoy,

Rich B.