2

I am trying to add weekdays to a date using the below formula:

$date = strtotime($effdate." +5 weekdays");
$date = date('m/d/Y', $date);

It works fine for other days but not for Friday. It points to the next Sunday rather than Friday. I googled for many solutions, but didn't get a clear idea.

Is there a workaround to fix this bug?

Keerthi
  • 923
  • 6
  • 22

1 Answers1

2

If you're running PHP < 5.5.0 then this is a known bug and was fixed in PHP 5.5

Demo

The bug report does provide an alternative function that will work with versions of PHP that are susceptible to this bug, though it's using DateTime objects rather than unix timestamps

Mark Baker
  • 209,507
  • 32
  • 346
  • 385