Skip to Content
0

Subtracting times in crystal reports

Oct 27, 2016 at 07:43 AM

38

avatar image

Hi All,

I have a time fields like this email sent time 1:11:00 AM and call time 1:33:32PM.

I need subtract call time from email sent time .I did like this but getting numbers.

email sent time-call time

Please help

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

2 Answers

Best Answer
Abhilash Kumar
Oct 28, 2016 at 07:51 AM
0

Hi Prasad,

If you need the difference in hh:mm:ss format, use this code:

NumberVar TotalSec := {email sent time} - {call time};
NumberVar Hours := Truncate (Remainder (TotalSec, 86400) / 3600);
NumberVar Minutes := Truncate (Remainder (TotalSec, 3600) / 60);
NumberVar Seconds := Remainder (TotalSec, 60);
(If Hours > 1 then Totext(Hours,0,'') & " Hours " else if Hours = 1 then Totext(Hours,0,'') & " Hour " else "")&
(If Minutes IN [0.1 to 1] OR Minutes > 1 then Totext(Minutes,0,'') & " Minutes " else if Minutes = 1 then Totext(Minutes,0,'') & " Minute " else "");

-Abhilash

Share
10 |10000 characters needed characters left characters exceeded
Brian Dong Oct 27, 2016 at 06:40 PM
0

Hi Prasad,

The number you are getting is the seconds between your times. So take that number and divide by 60 and you will get the number of minutes.

Your formula should look like:

({table.email sent} - {table.call time}) / 60; 

This will give you 697.47 minutes.

(({table.email sent} - {table.call time}) / 60) / 60; 
or
(({table.email sent} - {table.call time}) / 3600); 

Will give you 11.62 hours.

Thanks,

Brian

Share
10 |10000 characters needed characters left characters exceeded