Hello,
I have the below function to calculate the difference between two times (when the user LogsIn and LogsOut). I want to incorporate if Idle time was used to close the program, then deduct 15 minutes. If not, then do nothing.
Is this possible?
Let me know if you need the idle time code as well.
Thank you
I have the below function to calculate the difference between two times (when the user LogsIn and LogsOut). I want to incorporate if Idle time was used to close the program, then deduct 15 minutes. If not, then do nothing.
Is this possible?
Code:
Function DisplayTime(start As Date, finish As Date, fmt As String)
Dim Hours As Long, Minutes As Long, totalSeconds As Long, SecondLeft As Long
'format the differece of 2 dates or time
totalSeconds = DateDiff("s", start, finish)
Hours = Int(totalSeconds / 3600)
SecondLeft = totalSeconds Mod 3600
Minutes = Int(SecondLeft / 60)
Select Case fmt
' format = 100 Hours 50 Minutes
Case "H M"
If Hours = 0 Then
DisplayTime = Minutes & IIf(Minutes <> 1, " Minutes", " Minute")
Else
DisplayTime = Hours & IIf(Hours <> 1, " Hours", " Hour") & Minutes & IIf(Minutes <> 1, " Minutes", " Minute")
End If
End Select
End Function
Let me know if you need the idle time code as well.
Thank you