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

- June 29th 2006, 12:46 AMpsylencerConvert 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? - June 29th 2006, 02: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. - June 29th 2006, 02:45 AMsyrivaciHiQuote:

Originally Posted by**psylencer**

Let me know if this fulfils your requirements.

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

Originally Posted by**syrivaci**

- June 29th 2006, 05:28 AMsyrivaciHeheQuote:

Originally Posted by**JakeD**

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

Originally Posted by**syrivaci**

- June 29th 2006, 02:52 PMQuickQuote:

Originally Posted by**psylencer**

- June 29th 2006, 03:27 PMpsylencerQuote:

Originally Posted by**Rich B.**

- July 1st 2006, 02: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.