Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting duration to hours and minutes. HELP?

Status
Not open for further replies.

carmo

MIS
Dec 15, 2002
92
0
0
CA
I currently store a duration field in the form ex) 1.64 hours. In my report I would like to display it in hrs. and minutes. What is the best approach to do this. Thanks.
 
This is handled by creating two fields out of one. You may make the change either in:

1. The table itself--add field "hours" and field "minutes".
2. A query in which you calculate the calculated values "hours" and "minutes".
3. Inside the report itself, you can set the control source of a textbox to "=[calculations]"


To get hours:
Hours = Fix([duration_field_name])

To get minutes:
Minutes = ( ([duration_field_name] - Fix([duration_field_name]) ) * 60

That should do it.


--
Find common answers using Google Groups:

 
Well, one tenth of an hour is six minutes. One HUNDREDth of an hour is 36 seconds. I guess what you probably want to do is multiply the fractional part of the DURATION by 36

64 * 36 = 2304

convert that to whole minutes

2304 / 60 = 38.4

and then decide if you want to round up or down the .4 remainder.

1.64 hours = 1 hour, 38 minutes, and 4 tenths of a minute, if I did the math correctly. [dazed]

Jim

Me? Ambivalent? Well, yes and no....
Another free Access forum:
More Access stuff at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top