John_A Posted March 7, 2010 Share Posted March 7, 2010 Hi, I need a function to return the next x working days (Mon - Fri). So for 7 from today it would return: - Monday 8th March Tuesday 9th March Wednesday 10th March Thursday 11th March Friday 12th March Monday 15th March Tuesday 16th March But also with the ability to pass to it days to be excluded (for example Christmas / Boxing day and New Year's Day, as well as any custom public holidays). I've done something similar before but it ended up being rather long, I'm looking to keep this as short and simple as possible....any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/194438-return-array-of-next-x-working-days/ Share on other sites More sharing options...
premiso Posted March 7, 2010 Share Posted March 7, 2010 You could probably make a loop and check for Saturday / Sunday, if it is equal to that then omit. For the holidays, well you would have to take into account the "Observed" Holiday and calculate that, so you could not just simply define a date and viola! But it would be the same type of deal, if the date is equal to this date (either hardcoded in there or into an array) then you omit it and continue onwards. I am sure there are plenty of Calendar scripts that have this functionality that you could look at the decipher to create your own special function. Quote Link to comment https://forums.phpfreaks.com/topic/194438-return-array-of-next-x-working-days/#findComment-1022724 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.