PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
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.
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.
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