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?


You 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:


and $toFormat will output the following:

  • Glad it helped :) – Lodder Apr 24 '15 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.