cancel
Showing results for
Did you mean:
Highlighted
Nintex Newbie

## Calculating overtime hours

Hello everyone,

I have developed a sharepoint list to track the overtime for the employees in my department, at this point I was able to mesure the total of hours per day, now I need to identify which hours are diurnal and nocturnal, from 7.00 pm ahead are nocturnal hours. So if the employee started overtime from 5.00 until 8.00 pm he will have 2 diurnal hours and 1 nocturnal. That is the difference that I need specify.

Thanks to all

Labels: (2)

• ### Workflow

6 Replies
Highlighted
Automation Master

## Re: Calculating overtime hours

do you want to do this in the nintex form or the nintex workflow?

Highlighted
Nintex Newbie

## Re: Calculating overtime hours

Hi ‌, I would like this in the nintex form.

Thanks

Highlighted
Automation Master

## Re: Calculating overtime hours

I sense a complicated Calculated Value with some IF statements coming on!

Highlighted
Automation Master

## Re: Calculating overtime hours

can you use the runtime function in a calculated value control:

Returns the number of whole hours between date1 and date2.
dateDiffHours(date1, date2)

Highlighted
Automation Master

## Re: Calculating overtime hours

That'll get the time difference for sure, the next bit will be around figuring out whether the hours are nocturnal.

This is quite tricky because dateDiffHours only gives us the difference in the hours, not the a minus figure to indicate whether one is greater than the other.

You might also want to use dateDiffMinutes if you need more accurate figures.

I used 1 calculated value to get 7pm in the correct format

and another to get our start time  and end time in the correct format

formatDate(dateAddHours(Current Time, 7),"T") (this is just indicative, you would take your value from a control, but you need to format it in the same way)

Then I have a calculated value that checks if the start time was before 7PM and if so calculates the difference between the start time and 7PM.

If(start < sevenpm, dateDiffHours(start, sevenpm), "flag")

"Flag" simply tells me that the start time was after 7pm.

A similar calculation for the End time after 7pm.

If(end > sevenpm, dateDiffHours(endsevenpm), "late flag")

And then add the 2 values together to get the total hours. You can then use another IF statement to identify if either "flag" or "late flag" are the values. If they are then you wouldn't need to 2 separate values, just the total hours.

Keep in mind this is back of a fag packet stuff, I've not tested it properly, so if anyone can spot holes in this or indeed offer a better solution, go right ahead.

date calculations

Highlighted
Nintex Newbie