note 24848 added to function.date

From: Date: Fri, 30 Aug 2002 04:21:33 +0000
Subject: note 24848 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-36019@lists.php.net to get a copy of this message
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; -- http://www.php.net/manual/en/function.date.php http://master.php.net/manage/user-notes.php?action=edit+24848 http://master.php.net/manage/user-notes.php?action=delete+24848 http://master.php.net/manage/user-notes.php?action=reject+24848

« previous php.notes (#36019) next »