note 68376 added to function.date

From: Date: Tue, 25 Jul 2006 03:49:55 +0000
Subject: note 68376 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-115113@lists.php.net to get a copy of this message
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; } ?> ---- Server IP: 200.185.109.13 Probable Submitter: 200.158.156.63 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- http://master.php.net/note/edit/68376 Del: integrated -- http://master.php.net/note/delete/68376/integrated Del: useless -- http://master.php.net/note/delete/68376/useless Del: bad code -- http://master.php.net/note/delete/68376/bad+code Del: spam -- http://master.php.net/note/delete/68376/spam Del: non-english -- http://master.php.net/note/delete/68376/non-english Del: in docs -- http://master.php.net/note/delete/68376/in+docs Del: other reasons-- http://master.php.net/note/delete/68376 Reject -- http://master.php.net/note/reject/68376 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#115113) next »