note 99303 deleted from function.strtotime by derick
| From: | derick@php.net | Date: | Sun, 03 Nov 2013 15:20:21 +0000 |
| Subject: | note 99303 deleted from function.strtotime by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197406@lists.php.net to get a copy of this message | ||
Note Submitter: jamon at clearsightdesign dot com
----
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.
*
* @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;
}
?>