Ask the Expert

Calculate elapsed time in minutes

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: