How do I write a function in PHP that returns the date of delivery without Saturdays, Sundays and holidays?
For example: for same product delivery is in 3 days for others in 5 days.
If I do a command today I will receive my command in 3 days without Saturdays, Sundays and holidays.
If I do my command now “29/12/2011” for a product “3j” I will receive your command at “4/1/2011”
In the database I have just how much the day for every type product is.
For example:
prod1: 3day
prod2: 5day
prod3: 7day
I tried to do a function but failed.
This is a really complex subject that you can’t really fix with a simple function. You are talking about business days calculation strategies and they involve a lot of thinking.
If you want to process only business days and not business hours, then it get slightly easier.
The first step is to create an array of working days or an array of non working days. For example: