Skip to Content
avatar image
Former Member

Add 2 Times fields in Crystal Reports

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • May 10, 2017 at 07:28 AM

    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

    Add comment
    10|10000 characters needed characters exceeded