Calculate duration of time in crystal reports

Create one formula field give name “tot_seconds”

local stringvar array completetime;
local numbervar totalseconds;

if({dtAttendance.Time}”N/A”) Then
totalseconds:= ((3600*cdbl(completetime[1])) + (60*cdbl(completetime[2]))+(cdbl(“00”)));

{dtAttendance.Time} time is a report field which is display time in report.

If Check In times agains chechout time not found then display ‘N/A’ and vice versa so that we haven’t calculate that time in total therefore i have to put if condition regarding this.

Now, create another formula field “totalTime”, paste below code in “edit formula” section.

NumberVar TotalSec := sum({@tot_seconds},{dtAttendance.Name});

NumberVar Hours := Truncate ( TotalSec / 3600);
NumberVar Minutes := Truncate (Remainder ( TotalSec,3600) / 60);

Totext ( Hours, ‘####’) + ‘:’+
Totext ( Minutes,’00’)

If you are putting “totalTime” field into grouo section it will display group wise total.