note 62598 modified in function.getdate by danbrown

From: Date: Sun, 20 Jul 2008 03:07:11 +0000
Subject: note 62598 modified in function.getdate by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142023@lists.php.net to get a copy of this message
<?php // This functions calculates the next date only using business days // 2 parameters, the startdate and the number of businessdays to add function calcduedate($datecalc,$duedays) { $i = 1; while ($i <= $duedays) { $datecalc += 86400; // Add a day. $date_info = getdate( $datecalc ); if (($date_info["wday"] == 0) or ($date_info["wday"] == 6) ) { $datecalc += 86400; // Add a day. continue; } $i++; } return $datecalc ; } ?> --was-- // This functions calculates the next date only using business days // 2 parameters, the startdate and the number of businessdays to add function calcduedate($datecalc,$duedays) { $i = 1; while ($i <= $duedays) { $datecalc += 86400; // Add a day. $date_info = getdate( $datecalc ); if (($date_info["wday"] == 0) or ($date_info["wday"] == 6) ) { $datecalc += 86400; // Add a day. continue; } $i++; } return $datecalc ; } http://php.net/manual/en/function.getdate.php

« previous php.notes (#142023) next »