I'm trying to create a function that calculates a delivery time based on today's date.
It needs to do the following:
- if the time is less than 2pm ; add 3 days to today's date
- if the time is greater add 5 days
- if the 3/5 days land on a weekend, then the day needs to be Monday
I was wondering what the best approach would be?
Would it be worth putting valid days , i.e. into an array and checking if the date with days added is in it?
I have something like:
$date = time('H'):
If($date < '14') {
$delivery = date('Y-m-d', strtotime('+3 days')
}
else if($date > '14') {
$delivery = date('Y-m-d', strtotime('+5days')
}
return $delivery;