cancel
Showing results for 
Search instead for 
Did you mean: 

How to Calculate Total Worked Hours in a date range

Former Member
0 Kudos

<p><span>WorkedHours column type is varchar(8) (for HH:MM:SS), <br />how to sum working hours of an employee for every month.</span> <br /></p><p><span>ex. of data : WorkedHours<br /><br />attencode attendate WorkedHours<br />1573 20-01-2007 07:34:22<br />1573 21-01-2007 12:31:10<br /><br />how can i sum the WorkedHours and print it in Hours format.<br />(like 20.17 for this 2 values)<br /><br />Can u able to follow me.<br />If not pls. feel free to get more information in this regard.</span></p>

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Create a formula like this :

((hour({tmpDate.attendate }) * 60 * 60) +

(minute({tmpDate.attendate }) * 60) +

Second({tmpDate.attendate }))/3600

and then take the Sum of it. You can get the result.

logic behind this is all the hours and minutes are converted into seconds and then added and divided by 3600 to get the actual hours.

thanks

kanak

Answers (1)

Answers (1)

Former Member
0 Kudos

<p>datediff("h",#20-01-2007 07:34:22#,#21-01-2007 12:31:10#)</p><p>Rahul</p>

Former Member
0 Kudos

Rahul, I tried this formula but it doesn't show the minutes in decimal.