Time Difference/duration in Lotus Notes 8 form

5 pts.
Tags:
Lotus Forms
Lotus Notes 8
Lotus Notes Fields
I have a form in Lotus 8 where a user inputs a time value in "Field1". The format they use is MM:SS In "Field2" they input another time in the same format MM:SS I need to figure out in "Field3" to calculate the total duration. For example if the first field had 1:30 and the second field had 2:15. The third field will be 3:45.

Software/Hardware used:
Lotus Notes

Answer Wiki

Thanks. We'll let you know when a new response is added.

In formula, you could do something like:

t1:=@GetField( “Field1″ );
t2:=@GetFIeld( “Field2″ );
start:=@Date(2000; 1; 1; 0; 0; 0);
t3:=@Adjust(start; 0; 0; 0; 0; @ToNumber(@Left(t1;”:”))+@ToNumber(@Left(t2;”:”));@ToNumber(@Right(t1;”:”))+@ToNumber(@Right(t2;”:”)));
@Text(@Hour(t3))+”:”+@Text(@Minute(t3))+”:”+@Text(@Second(t3))

In LotusScript, you could do something like:

Dim t1 As String
Dim t2 As String
Dim baseline As New NotesDateTime( “1/1/00 12:00:00″ )
Dim ndt1 As New NotesDateTime( “1/1/00 12:00:00″ )
Dim tmp As Variant
t1 = “1:30″ <-this would really be something like doc.Field1(0)
t2 = “2:45″ <-this would really be something like doc.Field2(0)
Call ndt1.AdjustMinute( Val( Strleft( t1, “:” ) ) + Val( Strleft( t2, “:” ) ) )
Call ndt1.AdjustSecond( Val( Strright( t1, “:” ) ) + Val( Strright( t2, “:” ) ) )
tmp = Format( Timenumber( 0, 0, ndt1.Timedifference( baseline ) ), “h:nn:ss” ) <-instead of assigning to tmp, you would assign to Field3

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

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
  • ChrisDM
    Set the 3rd field to computed and do a... Fld2-Fld1 formula alternatively: If you are using lotusScript you can use either of these: Returns the difference in seconds as a double difference = notesdatetimeobj.TimeDifferenceDouble(othernotesdatetimeobj) Returns the difference in seconds as a long difference = notesdatetimeobj.TimeDifference(othernotesdatetimeobj) Hope that helps.
    65 pointsBadges:
    report
  • Stiletto
    That won't work; he wants to add the 2 values, not find the difference between them
    3,830 pointsBadges:
    report

Forgot Password

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

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

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

Thanks! We'll email you when relevant content is added and updated.

Following