Half day leave
Posted: Thu Jan 05, 2012 3:03 am
Hi Everyone,
How to calculate two dates with time differencial. Im having a difficulties how to manage this logic. I want the employee to apply a leave in half day. but the result will be like this.
first 4 hours is equivalent to 0.5
whole day is equivalent to 1.0
example working hours
8am to 12pm is 0.5
1pm to 5pm will equivalent to 0.5 also.
and 24 hours is equivalent to 1.0
for example:
12/01/2012 08:00am
12/01/2012 12:00pm
result is 0.5
12/10/2012 01:00pm
12/10/2012 5:00pm
result is 0.5
12/12/2012
12/12/2012
result is 1
12/25/2012 1:00pm
12/26/2012 5:00pm
result is 1.5
help will be appreciated.

How to calculate two dates with time differencial. Im having a difficulties how to manage this logic. I want the employee to apply a leave in half day. but the result will be like this.
first 4 hours is equivalent to 0.5
whole day is equivalent to 1.0
example working hours
8am to 12pm is 0.5
1pm to 5pm will equivalent to 0.5 also.
and 24 hours is equivalent to 1.0
for example:
12/01/2012 08:00am
12/01/2012 12:00pm
result is 0.5
12/10/2012 01:00pm
12/10/2012 5:00pm
result is 0.5
12/12/2012
12/12/2012
result is 1
12/25/2012 1:00pm
12/26/2012 5:00pm
result is 1.5
help will be appreciated.