How can I calculate Next Business Day given a Zend_Date and a cutoff time of 5pm? Business days are M-F (weekdays).
Example: Fri 4 pm should return same date Sat anytime should return next Mon Tue 8 pm should return Wed
How can I calculate Next Business Day given a Zend_Date and a cutoff time of 5pm? Business days are M-F (weekdays).
Example: Fri 4 pm should return same date Sat anytime should return next Mon Tue 8 pm should return Wed
I think this has been asked before, Next business day of given date in PHP, but here it is using Zend_Date:
$now = new Zend_Date();
if (($now->get(Zend_Date::WEEKDAY_DIGIT) % 6 == 0)
|| ($now->isLater('17:00:00', Zend_Date::TIMES))
) {
$now->set(
strtotime('+1 weekday', $now->toString(Zend_Date::TIMESTAMP)),
Zend_Date::TIMESTAMP
);
}
echo $now->toString(Zend_Date::W3C);