I need to calculate the elapsed time in minutes. (Eg:Start Time - 2:30PM End Time - 5:30PM, Elapsed Time= 180 minutes) How can I achieve this? Thank you.


<DAVECOMMENT>You can do it fairly easily in either the formula language or LotusScript. I have included a simple example, using time constants in both languages. Good Luck!

<START FORMULA EXAMPLE>
Time1:=[08:00:01];
Time2:=[10:00:01];
Time3:=Time2-Time1;
@Prompt([OK];"Test A";@Text(Time3));
@Prompt([OK];"Test A";@Text(Time3/60))
<END FORMULA EXAMPLE>

When you subtract date/time values, the resultant value is the time difference in seconds. Simply divide this number by 60 to get the minutes.

<START LS EXAMPLE>
	Dim ndtTime1 As New NotesDateTime("08:00:00")
	Dim ndtTime2 As New NotesDateTime("10:00:00")
	Dim lngTimeDiff As Long
	Dim intMinutes As Integer
	intMinutes=60
	lngTimeDiff=ndtTime2.TimeDifference(ndtTime1)
	Print lngTimeDiff/intMinutes
<END LS EXAMPLE>

This was first published in December 2001