Manage Learn to apply best practices and optimize your operations.

Subroutine To Calculate Time Difference Between Two Dates

This subroutine takes in two NotesDateTime objects and compute the time difference between them.

The result is broken up into 4 main time elements i.e. days, hours, minutes and seconds.

Sub CalculateDateTimeDifference (dateFrom As NotesDateTime, dateTo As NotesDateTime, _ usedDays As Integer, usedHours As Integer, usedMinutes As Integer, usedSeconds As Integer)

'Get the time difference using the lowest time unit : seconds difference = (dateTo.LSLocalTime - dateFrom.LSLocalTime)*24*60*60

'Compute used hours
usedDays = Int(difference/86400)
remainingSec = difference Mod 86400

'Compute used seconds
usedHours = Int(remainingSec/3600)
remainingSec = remainingSec Mod 3600

'Compute used minutes
usedMinutes = Int(remainingSec/60)
remainingSec = remainingSec Mod 60

'Compute used seconds
usedSeconds = remainingSec

End Sub

Dig Deeper on Domino Resources - Part 4

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...