Created
November 2, 2011 20:30
-
-
Save davidsalazar/1334817 to your computer and use it in GitHub Desktop.
Add business days
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can't believe all the other functions out there have daylight saving bugs, mine does not.