on 07-23-2015 12:00 PM
hi,
I have two fields
SR.NO | IN TIME | OUT TIME | DIFF HRS |
---|---|---|---|
1 | 10:20:31 | 20:10:10 | ? |
2 | 08:20:20 | 18:10:20 | ? |
Total |
i want to calculate time between this 2 time (In Time & Out Time) in crystal report level.
please reply me fast !!!!
Thanks !!!!
Local NumberVar DaysDiff;
Local NumberVar HoursDiff;
Local NumberVar MinutesDiff;
Local NumberVar SecondsDiff;
Local StringVar strOut;
SecondsDiff := DateDiff('s',{table.InTime},{table.OutTime});
DaysDiff := SecondsDiff \ (24 * 60 * 60);
SecondsDiff := SecondsDiff MOD (24 * 60 * 60);
HoursDiff:= SecondsDiff \ (60 * 60);
SecondsDiff := SecondsDiff MOD (60 * 60);
MinutesDiff:= SecondsDiff \ (60);
SecondsDiff := SecondsDiff MOD (60);
If DaysDiff > 0 then
strOut := CStr(DaysDiff ,0) & ' days ';
strOut := strOut & CStr(HoursDiff,0) & '.' & CStr(MinutesDiff,'00') & '.' & CStr(SecondsDiff ,'00') ;
strOut
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ashwini,
Assuming these fields are 'time' and you wish to display the difference in HH:MM format, try this:
NumberVar TotalSec := {@In Time} - {@Out Time};
NumberVar Hours := Truncate ( TotalSec / 3600);
NumberVar Minutes := Truncate (Remainder ( TotalSec,3600) / 60);
Totext ( Hours, '####') + ':'+ Totext ( Minutes,'00');
-Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.