Hours and Minutes from Minutes

CutAndPaste

Registered User.
Local time
Today, 11:40
Joined
Jul 16, 2001
Messages
60
I'm adding the total minutes spent on an activity and want to convert the results to hours and minutes for a report so that a total of 45 minutes becomes "45 minutes" and 75 minutes becomes "1 hour and 15 minutes" etc. etc.

Anyone know of a code snippet / function to do this?

Thanks.
 
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

TheHours = MyMinutes\60
TheMinutes = MyMinutes Mod 60

HourLabel = " Hour"
MinuteLabel = " Minute"
If TheHours > 1 then HourLabel = " Hours"
If TheMinutes <> 1 then MinuteLabel = " Minutes"
If TheHours = 0 then
me.ReportControl = TheMinutes & MinuteLabel
else
me.ReportControl = TheHour & HourLabel & " and " & TheMinutes & MinuteLabel

End sub

Give this a try!

[This message has been edited by pdx_man (edited 07-17-2001).]
 

Users who are viewing this thread

Back
Top Bottom