Page 1 of 1

Half day leave

Posted: Thu Jan 05, 2012 3:03 am
by jauson
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.

:drunk:

Re: Half day leave

Posted: Fri Jan 06, 2012 1:03 am
by Christopher
Seems like you could find the number of hours that a person worked with the values you show. You might need to do a first pass would be to add additional beginning/end of day entries for those ranges that span multiple days. Then you can divide the number of hour in each range by 8 to get the result values.

Re: Half day leave

Posted: Sun Jan 08, 2012 6:15 pm
by jauson
can you explain further?

Re: Half day leave

Posted: Mon Jan 09, 2012 1:12 am
by Christopher
Which part?

Re: Half day leave

Posted: Sun Jan 15, 2012 7:40 pm
by jauson
when the employee applied for a leave. and they have 8 working hours.
for example John is 8am to 5 pm and he wants to apply on february 1, 2012 (vacation leave) but half day only so on my form.

he needs to fill up

date from: February 1 2012 8:00 AM
date to: February 1 2012 12: 00 PM
counts: .5

another example
Ellise wants to apply vacation leave on February 12 2012 and he wants to use his 8 working hours.

so on my form

date from: February 12 2012 00:00
date to: February 13 2012 00:00
counts: 1.0

thanks