Skip to Content
0

Add 2 Times fields in Crystal Reports

May 10, 2017 at 06:05 AM

83

avatar image
Former Member

HI,

I have 2 time fields in my report called TimeTalk (00:03:31)and TimeHold. (00:02:49)

I want calculate Total call duration (00:06:20).

Could you please suggest me how can I add the 2 time fields in Crystal Reports.

Regards.

Krishna Reddy

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Ian Waterman May 10, 2017 at 07:28 AM
0

I think only way is to convert to seconds, create formula

@AddTime

Local numbervar hours1:= 3600*tonumber(left(timefield1, 2);

Local numbervar mins1:= 60*tonumber(mid(timefield1, 4,2);

Local numbervar secs1:= tonumber(right(timefield1, 2);

Repeat above for time field 2

Then add then all together

Local numbervar totalmins:= int (hours1+mins1+secs1+hours2+mins2+secs2);

Local numbervar totalsecs:= remainder((hours1+mins1+secs1+hours2+mins2+secs2),60);

totext(totalmins,0,"")&':'&totext(totalsecs,0,"");

Ian

Share
10 |10000 characters needed characters left characters exceeded