note 67802 added to function.date
| From: | hsinche+at+yahoo+dot+com at osu1 dot php dot net | Date: | Wed, 05 Jul 2006 18:29:24 +0000 |
| Subject: | note 67802 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-114376@lists.php.net to get a copy of this message | ||
<?php
// revolving Friday code
//
// This script displays this coming Friday's date, unless it
// is Friday after 9:45am, when it should show the next Friday's date.
// Alternatively, you can pass an hour and minute to the function.
function getFriday($hour = 9, $minute = 45) {
$day = 60 * 60 * 24; // 1 day is 60 seconds * 60 minutes * 24 hours
switch(date("l")) {
case "Friday":
$h = date("G");
switch(TRUE) {
case $h < $hour:
case ($h == $hour && date("i") < $minute):
$nextDate = date("F j, Y");
break;
default:
$t = time() + (7 * $day);
$nextDate = date("F j, Y", $t);
}
break;
default:
$mod = 5 - date("w");
if($mod < 0) {
$mod = 6;
}
$t = time() + ($mod * $day);
$nextDate = date("F j, Y", $t);
}
echo $nextDate;
}
?>
----
Server IP: 216.194.113.175
Probable Submitter: 207.88.114.210
----
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/67802
Del: integrated -- http://master.php.net/note/delete/67802/integrated
Del: useless -- http://master.php.net/note/delete/67802/useless
Del: bad code -- http://master.php.net/note/delete/67802/bad+code
Del: spam -- http://master.php.net/note/delete/67802/spam
Del: non-english -- http://master.php.net/note/delete/67802/non-english
Del: in docs -- http://master.php.net/note/delete/67802/in+docs
Del: other reasons-- http://master.php.net/note/delete/67802
Reject -- http://master.php.net/note/reject/67802
Search -- http://master.php.net/manage/user-notes.php