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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

minute converter

Status
Not open for further replies.

bagman

Technical User
Aug 13, 2001
1
US
Hey people,

I was wondering how i split say 200 minutes into hours and minutes...


I display the "minutes" in one label (using a scroll bar) and then show (next to) that calculated into "hours and minutes" (2 seperate labels)...

Thanks

 
Here is some code that should do what you want . . .

Code:
dim intHours as integer
dim intMinutes as integer

intMinutes = 200
intHours = cint(intMinutes/60)
intMinutes = intMinutes - (intHours*60)
- Jeff Marler B-)
 

Another alternative....

Public Function ConvertMinutes(iMinutes As Integer) As Variant

ConvertMinutes = DateAdd("n", iMinutes, #12:00:00 AM#)

End Function

'Call example...

Label1.Caption = ConvertMinutes(200)
 
? Format(200/(60 * 24), "Short Time")
03:20

MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
The problem with the Format solution is that it produces incorrect results for the given problem once the number of minutes reaches and/or exceeds 1440
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top