note 99303 modified in function.strtotime by danbrown

From: Date: Mon, 20 Jun 2011 15:01:27 +0000
Subject: note 99303 modified in function.strtotime by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-180700@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. * * @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; } ?> --was-- 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). * * @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; } ?> http://php.net/manual/en/function.strtotime.php

« previous php.notes (#180700) next »