Skip to content

Instantly share code, notes, and snippets.

@davidsalazar
Created November 2, 2011 20:30
Show Gist options
  • Save davidsalazar/1334817 to your computer and use it in GitHub Desktop.
Save davidsalazar/1334817 to your computer and use it in GitHub Desktop.
Add business days
public function add_business_days($datetime, $duedays)
{
$i = 1;
while ($i <= $duedays)
{
$next_day = date('N', strtotime('+1 day', $datetime));
if ($next_day == 6 || $next_day == 7)
{
$datetime = strtotime('+1 day', $datetime);
continue;
}
$datetime = strtotime('+1 day', $datetime);
$i++;
}
return $datetime;
}
@davidsalazar
Copy link
Author

can't believe all the other functions out there have daylight saving bugs, mine does not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment