Multiply hours

wilde1

New member
Local time
Today, 07:51
Joined
May 12, 2004
Messages
6
How can I mutiply the number of hours x the number of sessions i.e. format hh:nn * general number to return total hours used
 
What happens if your number of hours go over 23:59 ? ;)

Essentially, I don't see why you are using a number of hours as a Date/Time format. The Date/Time data type is for hours of a day.
 
I've got a scheduling system where times are all in date format. Run times are also calculated as days so I can add next run to end of last run etc to build the schedule.
Users want to see the duration of each run in hours rather than days however, so I used:

Code:
Function ExtendHours(InTime As Date, TimeType As String) As String

Dim x As Single

Select Case TimeType
Case "Days"
    x = 1440 * InTime - Int(InTime * 24) * 60
    ExtendHours = Int(InTime * 24) & ":" & Format(Int(x), "00")
Case "Seconds"
    x = (InTime - Int(InTime / 3600) * 3600) / 60
    ExtendHours = Int(InTime / 3600) & ":" & Format(Int(x), "00")
End Select

End Function
 

Users who are viewing this thread

Back
Top Bottom