A function that returns the difference between two dates in hours minutes and seconds
A function that returns the difference between two dates in hours minutes and seconds
Rate A function that returns the difference between two dates in hours minutes and seconds
(2(2 Vote))
TotalSeconds = DateDiff("s", Format(StartDate, "dd/mm/yyyy hh:mm:ss"), Format(FinishDate, "dd/mm/yyyy hh:mm:ss"))
If TotalSeconds > 59 Then
ExecutionMinutes = Int(TotalSeconds / 60)
If ExecutionMinutes > 59 Then
ExecutionHours = Int(ExecutionMinutes / 60)
ExecutionMinutes = Int(ExecutionMinutes - (ExecutionHours * 60))
ExecutionSeconds = Int(TotalSeconds - ((ExecutionHours * 3600) + ExecutionMinutes * 60))
Else
ExecutionSeconds = TotalSeconds - (ExecutionMinutes * 60)
executiontime = ExecutionMinutes & " minutes and " & ExecutionSeconds & " seconds"
End If
Else
executiontime = TotalSeconds & " seconds"
End If
GetExecutionTimeFor = executiontime
End Function
'To Test Try
MsgBox GetExecutionTimeFor("04/04/2002 01:12:30", "04/04/2002 02:15:50")
A function that returns the difference between two dates in hours minutes and seconds Comments
No comments yet — be the first to post one!
Post a Comment