Times_inHours

Calculate the total number of hours between two times and return in format fashion.
Needed in recent project calculating log of times from database.

CodeFunctionName
What is this?

Public

Tested

Original Work

Function Times_inHours(StartTime, EndTime)
    TotalTime14 = (EndTime- StartTime)
    Times_inHours= Fix(TotalTime14 * 24) & ":" & Right("00" & Fix(((TotalTime14 * 24) - Fix((TotalTime14 * 24))) * 60) , 2)
End function
' Below is the original code used in original project where we needed that function.
' Part of CLERS for MOEB
'    Time clocking system for Bancrupcy courts for Missory
' If you have times saved in database as
'    Time1        Time2
'    8:00 AM    01:00 PM
'    7:30 AM    03:40 PM
'    8:06 AM    06:16 PM
' Then getting total of hours for 14 days of these records is tricky
'    TotalTime14 = TotalTime14 + (Time2 - Time1)
'Found solution with ...
'    TotalTime14 = Fix(TotalTime14 * 24) & ":" & Right("00" & Fix(((TotalTime14 * 24) - Fix((TotalTime14 * 24))) * 60) , 2)

StartTime, EndTime

Views 113

Downloads 57

CodeID
DB ID