kaydee Posted February 26, 2010 Share Posted February 26, 2010 Hi, Please assist with logic for the following. Given a start date (any Monday) and no. of weeks an employee is contracted for, employee's finish date (Friday) is worked out. (Have got it by using mysql_result(mysql_query(SELECT DATE_ADD('$start_date', INTERVAL $total_weeks * 7 - 3 DAY) AS date, 0); Need to provision for Christmas break (start and finish date for the break are given), when the finish date is within the break period or after. (start and finish date for the break period are read from the database and available within the script) My question is -> How to calculate the finish date so as to make required adjustment as of the break period? Thanks KD Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 26, 2010 Share Posted February 26, 2010 Can you just not add however many days the break period is on to the end of your work days? Figure out how many days the vacation time is, then when you figure your work days just add the vacation time on to it? That or use some sort of if statement and a loop, skip the days that are for vacations. Quote Link to comment Share on other sites More sharing options...
kaydee Posted February 26, 2010 Author Share Posted February 26, 2010 Agreed, but when to add the vacation period? The scenarios could be as below. [*]Work start and Finish dates are before Christmas - no addition required. [*]Start date is before Christmas and End date falls between the Christmas break - will have to add only the weeks elapsed from start of the break till Finish date [*]Start date is before Christmas and End date is after Christmas break - will add the total break period to the Finish date Please help with the if statement logic! Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.