note 24848 deleted from function.date by sniper
| From: | sniper@php.net | Date: | Sat, 11 Oct 2003 16:50:26 +0000 |
| Subject: | note 24848 deleted from function.date by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58263@lists.php.net to get a copy of this message | ||
Note Submitter: nuroslam@defendem.com
----
A simple function to check a date and modify it based on time of day and day of week to handle next
business day orders. Two assumptions orders placed after 1 are next day and no business done on
weekends
function businessday(){
global $newday;
$current_date = date("Y-m-d");
$current_day = date("w");
$current_hour = date("H");
$add_days = 0;
if($current_hour > 13){
$add_days = 1;
}
if($current_day == 5){
$add_days = 3;
}
$newday = date("Y-m-d", strtotime("$current_date + $add_days days"));
return $newday;
}
businessday();
print $newday;