G
Guest
I put a message in asking for help on a time calculation over midnight on
July 13th.
At the time, I "thought" all was great with the caluclation.
However, I'm now seeing that I still have problems.
Here is the calculation that Ken Snell so thoughtfully provided for me:
TotalHoursOnDuty:
DateDiff("n",[DateWorked]-IIf(1-[StartTimeOnDuty]>[EndTimeOnDuty],0,1)+[StartTimeOnDuty],[DateWorked]+IIf(1-[StartTimeOnDuty]>[EndTimeOnDuty],1,0)+[EndTimeOnDuty])
The reason for the extra code is that I have only one Work Date in the
Table. So we needed a way to force the Work Date to be used twice.
Here is a table of data that uses the data and shows the problem in the far
right column. The midnight portion of the formula works. But, now, the rest
of the times that don't go over midnight don't work.
Unit Work Start End Total Hours Format True
ID Date Time Time On Duty Hours Hours
1234 4/2/2005 20:00 2:00 360.00 6:00 6:00
1234 4/5/2005 7:00 15:00 1920.00 32:00 8:00
1234 4/11/2005 9:00 16:30 1890.00 31:30 7:30
I tried another formula (shown below) but it didn't work either.
Can you help me so more?
Santara
July 13th.
At the time, I "thought" all was great with the caluclation.
However, I'm now seeing that I still have problems.
Here is the calculation that Ken Snell so thoughtfully provided for me:
TotalHoursOnDuty:
DateDiff("n",[DateWorked]-IIf(1-[StartTimeOnDuty]>[EndTimeOnDuty],0,1)+[StartTimeOnDuty],[DateWorked]+IIf(1-[StartTimeOnDuty]>[EndTimeOnDuty],1,0)+[EndTimeOnDuty])
The reason for the extra code is that I have only one Work Date in the
Table. So we needed a way to force the Work Date to be used twice.
Here is a table of data that uses the data and shows the problem in the far
right column. The midnight portion of the formula works. But, now, the rest
of the times that don't go over midnight don't work.
Unit Work Start End Total Hours Format True
ID Date Time Time On Duty Hours Hours
1234 4/2/2005 20:00 2:00 360.00 6:00 6:00
1234 4/5/2005 7:00 15:00 1920.00 32:00 8:00
1234 4/11/2005 9:00 16:30 1890.00 31:30 7:30
I tried another formula (shown below) but it didn't work either.
Can you help me so more?
Santara