October 10th, 2012, 01:55 AM
Calculate a timespan of work of an employee in an HR system
There are 2 pay rates - normal rates and overtime rates.
An employee can work in many different hour combination say
* 2012-10-30 08:00 to 2012-10-30 18:30
* 2012-10-30 10:30 to 2012-10-30 15:00
* 2012-10-30 07:00 to 2012-11-02 23:00
Despite of leaves and other allowances, how do you calculate their time spans of work
Say in the first day, he works from 7:00 - 23:59 and 2 full days and the last day 0:00 to 23:00 etc
My first thought was to convert this to a Calendar and compare the dates first and work out the full days worked.
if there is at least one full day, I subtract 23:59 from his on-duty time
and subtract his off-duty time from 0:00.
And then, I compare the range of time with the normal working-hours and OT hours
The problem is how do you convert a timestamp data type to calendar?
Am I on the right track?
Last edited by lucky6969b; October 10th, 2012 at 02:18 AM.
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!