cancel
Showing results for 
Search instead for 
Did you mean: 
walter9000
Nintex Newbie

Calculating overtime hours

Jump to solution

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)
Reply
6 Replies
Automation Master
Automation Master

Re: Calculating overtime hours

Jump to solution

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

Reply
walter9000
Nintex Newbie

Re: Calculating overtime hours

Jump to solution

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

Thanks

0 Kudos
Reply
Automation Master
Automation Master

Re: Calculating overtime hours

Jump to solution

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

Reply
Automation Master
Automation Master

Re: Calculating overtime hours

Jump to solution

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

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

Reply
Automation Master
Automation Master

Re: Calculating overtime hours

Jump to solution

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

formatDate(dateAddHours(Current Date, 19),"T")

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 

Reply
walter9000
Nintex Newbie

Re: Calculating overtime hours

Jump to solution

Thanks Ryan, this works perfectly, I will find a way to measure the minutes, but you solved my issue. This is great..

0 Kudos
Reply