Converting time

G

Guest

Could anyone show me a formula that converts hours and minutes into a numeric
value? Example: 7:15 (hh:ss) 7 hours 15 minutes. I want to convert this to
7.25 hours. Any help would be greatly appreciated.
Paul
 
G

Guest

Mybe there is a better way, but you can try

(hour([TimeField])*60+Minute([TimeField]))/60


Also, to get just two digits after the dot you can try

Round((hour([TimeField])*60+Minute([TimeField]))/60,2)
 
J

John Spencer

How about just
Hour([TimeField]) + (Minute([TimeField])/60

'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
M

missinglinq via AccessMonster.com

First off, John, you omitted a parenthesis, or added one too many, depending
on how you look at it! Which I have to say is most unusal for you! Should be
either

Hour([TimeField]) + (Minute([TimeField])/60)

or

Hour([TimeField]) + Minute([TimeField])/60

but more importanly, entering, say 7:11 and using your formula will yield

7.18333333333333

which probably isn't exactly what the the OP wants! Of course I could be
wrong! As I tell my fourth wife "I was wrong three times before, maybe four!"
So maybe a combination of your code and Ofer's:

Round(Hour([OriginalTime]) + Minute([OriginalTime]) / 60, 2)

BTW, what are you people up in Balmer doing for crabs, now that Bohagers has
closed down?

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top