I need to add 15 days more to current date in Joomla excluding Sat and Sun.
I added it with following code:
JFactory::getDate()->modify('+15 days');
But it doesn't exclude Saturday and Sunday. Any idea how can I do it?
Joomla Stack Exchange is a question and answer site for Joomla! administrators, users, developers and designers. It only takes a minute to sign up.
Sign up to join this communityYou should be able to use the following if you want to add 15 working/business days:
$date = JFactory::getDate();
$newDate = new JDate($date . ' +15 Weekday');
$toFormat = $newDate->format('Y-m-d');
Today is the 24th April 2015, so $date
(excluding the time), will output the following:
2015-04-24
and $toFormat
will output the following:
2015-05-15