I have 5 different schedules for 5 weeks:
- first week = Monday to Friday (8am to 5pm) && Rest days on Saturday and Sunday
- second week = Monday to Friday (10am to 6pm) && Rest days on Saturday and Sunday
- third week = Monday to Friday (11am to 7pm) && Rest days on Saturday and Sunday
- fourth week = Monday Rest Day && Tuesday to Saturday (10:30 am to 6:30pm) && Sunday Rest Day
- fifth week = Monday Rest Day && Tuesday to Saturday (8:30 am to 5:30pm) && Sunday Rest Day
Base on my calculation array [0],[0] which is Monday of first week is set to April 25, 2011.
I have this code to compute the difference between input date and start date, which is April 25, 2011.
$tdays = floor((strtotime($date2) - strtotime($date1))/86400);
I could now compute my work schedule starting April of 2011 up until February of 2012. However if I enter a date beyond February 2012, the output is wrong due to leap year. Is there a technique for this?