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?

Printable View

- Jun 28th 2006, 11:46 PMpsylencerConvert 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 AMRich 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 AMsyrivaciHiQuote:

Originally Posted by**psylencer**

Let me know if this fulfils your requirements.

No doubt someon else will have a better method. :) - Jun 29th 2006, 04:15 AMJakeDQuote:

Originally Posted by**syrivaci**

- Jun 29th 2006, 04:28 AMsyrivaciHeheQuote:

Originally Posted by**JakeD**

I have a feeling some people on this forum are related to Einstein :rolleyes: :D - Jun 29th 2006, 01:39 PMpsylencerQuote:

Originally Posted by**syrivaci**

- Jun 29th 2006, 01:52 PMQuickQuote:

Originally Posted by**psylencer**

- Jun 29th 2006, 02:27 PMpsylencerQuote:

Originally Posted by**Rich B.**

- Jul 1st 2006, 01:43 AMRich 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.