converting minutes to time

siouxprincess

Registered User.
Local time
Today, 10:10
Joined
Jun 27, 2007
Messages
11
This is for a report.

I'd like to convert minutes to time in the format: hh:mm:ss

Example: 4762 minues is 79:22:00

The field is: sys_request_hdmins This is figured for an 8 hr. work day.
 
I am sure there is a better way but this works. Assuming that your minutes are in Text1 and the answer is in Text2, then put: (just comment out the MsgBox's - just there for me to track progress!)

Private Sub SomeEvent(Cancel As Integer)

Dim intH, intM As Integer
Dim sNo As Single

Text2.Text = Text1.Value / 60
'MsgBox Text2.Value
intH = Int(Text2.Value)
'MsgBox intH
sNo = (Text1.Value / 60) - intH
'MsgBox sNo
intM = Int(sNo * 60)
'MsgBox intM
Text2.Value = CStr(intH & ":" & intM & ":00")

End Sub
 
Last edited:

Users who are viewing this thread

Back
Top Bottom