note 68376 deleted from function.date by bobby

From: Date: Thu, 07 Sep 2006 17:57:40 +0000
Subject: note 68376 deleted from function.date by bobby
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-116854@lists.php.net to get a copy of this message
Note Submitter: carlosreche at yahoo dot com ---- Here is a function to return the timestamp for the next working day. It can be relative to a reference date or to the current one, if reference date is NULL. <?php /** * @function next_working_day * @param mixed refDate * * Carlos Reche * Jul 25, 2006 */ function next_working_day($refDate = null, $workOnSaturday = false) { if (!is_integer($refDate)) { $refDate = is_string($refDate) ? strtotime($refDate) : time(); } if (!$workOnSaturday) { do { $weekDay = (int)date("w", ($refDate += 86400)); } while (($weekDay == 0) || ($weekDay == 6)); } else { do { $weekDay = (int)date("w", ($refDate += 86400)); } while ($weekDay == 0); } return $refDate; } ?>

« previous php.notes (#116854) next »