Calculation of time after midnight

Hi all

I'm working on a worksheet of employee time. There are 4 time fields (amIN, amOUT, pmIN, pmOUT) to allow a lunch break. I have a script that calculates for the normal office hours. BUT, if the shift goes beyond midnight, then it does not calculate correctly.

Here's what I have in FormCalc in an event to calculate:

fullTime var = 0
var = 0 recreation

If (pmIN don't pmOUT null and not null) then
If (Time2Num (amIN.formattedValue, "HH: mm") < Time2Num (pmOUT.formattedValue, "HH: mm")) then
full time = Abs (Time2Num (amIN.formattedValue, "HH: mm")-Time2Num (pmOUT.formattedValue, "HH: mm")) / (60 * 60 * 1000)
on the other
full time = 24 - Abs (Time2Num (pmOUT.formattedValue, "HH: mm")-Time2Num (amIN.formattedValue, "HH: mm")) / (60 * 60 * 1000)
endif

recess = Abs (Time2Num (pmIN.formattedValue, "HH: mm")-Time2Num (amOUT.formattedValue, "HH: mm")) / (60 * 60 * 1000)
$ = fullTime - recreation
on the other

full time = Abs (Time2Num (amIN.formattedValue, "HH: mm")-Time2Num (amOUT.formattedValue, "HH: mm")) / (60 * 60 * 1000)
$ = full time

If (amIN == null) then $= null else $= (full time - recess)
endif

endif

Someone help me please?

Thank you

Gene-O

Ok

I changed the script so it will check if amIN's largest amOUT.

fullTime var = 0

var = 0 recreation

If (amIN don't pmOUT null and not null) then

If (Time2Num (amIN.formattedValue, "HH: mm") lt Time2Num (pmOUT.formattedValue, "HH: mm")) then

full time = Abs (Time2Num (amIN.formattedValue, "HH: mm")-Time2Num (pmOUT.formattedValue, "HH: mm")) / (60 * 60 * 1000)

on the other

full time = 24 - Abs (Time2Num (pmOUT.formattedValue, "HH: mm")-Time2Num (amIN.formattedValue, "HH: mm")) / (60 * 60 * 1000)

endif

If (amOUT not null and not null pmIN) then

If (Time2Num (amOUT.formattedValue, "HH: mm") lt Time2Num (pmIN.formattedValue, "HH: mm")) then

recess = Abs (Time2Num (pmIN.formattedValue, "HH: mm")-Time2Num (amOUT.formattedValue, "HH: mm")) / (60 * 60 * 1000)

on the other

recess = 24 - Abs (Time2Num (pmIN.formattedValue, "HH: mm")-Time2Num (amOUT.formattedValue, "HH: mm")) / (60 * 60 * 1000)

endif

endif

$ = fullTime - recreation

else if (null not amIN and amOUT pmIN eq eq pmOUT null null and not null) then

If (Time2Num (amIN.formattedValue, "HH: mm") lt Time2Num (amOUT.formattedValue, "HH: mm")) then

$ = Abs (Time2Num (amOUT.formattedValue, "HH: mm")-Time2Num (amIN.formattedValue, "HH: mm")) / (60 * 60 * 1000)

on the other

$ = 24 abs (Time2Num (amOUT.formattedValue, "HH: mm")-Time2Num (amIN.formattedValue, "HH: mm")) / (60 * 60 * 1000)

endif

on the other

$ = full time

endif

Tags: Adobe LiveCycle

Similar Questions

Maybe you are looking for