note 99303 added to function.strtotime
| From: | jamon at clearsightdesign dot com | Date: | Tue, 10 Aug 2010 07:42:19 +0000 |
| Subject: | note 99303 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-171503@lists.php.net to get a copy of this message | ||
Here's a PHP function to find the next valid weekday. Modify as necessary for your needs.
- Jamon Holmgren
<?php
/**
* next_weekday() - finds the next valid weekday given a timestamp.
* $next_weekday = valid_weekday($timestamp);
*
* By Jamon Holmgren (www.jamonholmgren.com). Free for personal or commercial use.
*
* @return int
*/
function next_weekday($timestamp = NULL) {
if($timestamp === NULL) $timestamp = time();
$next = strtotime("midnight +1 day", $timestamp);
$d = getdate($next);
if($d['wday'] == 0 || $d['wday'] == 6) $next = strtotime("midnight next
monday", $timestamp);
return $next;
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 67.160.169.15
----
Manual Page -- http://www.php.net/manual/en/function.strtotime.php
Edit -- https://master.php.net/note/edit/99303
Del: integrated -- https://master.php.net/note/delete/99303/integrated
Del: useless -- https://master.php.net/note/delete/99303/useless
Del: bad code -- https://master.php.net/note/delete/99303/bad+code
Del: spam -- https://master.php.net/note/delete/99303/spam
Del: non-english -- https://master.php.net/note/delete/99303/non-english
Del: in docs -- https://master.php.net/note/delete/99303/in+docs
Del: other reasons-- https://master.php.net/note/delete/99303
Reject -- https://master.php.net/note/reject/99303
Search -- https://master.php.net/manage/user-notes.php