note 55890 deleted from function.date by danbrown

From: Date: Sun, 20 Jul 2008 03:00:06 +0000
Subject: note 55890 deleted from function.date by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142010@lists.php.net to get a copy of this message
Note Submitter: steve at somejunkwelike dot com ---- re: Paul_liversidge... This is a way to get the next 10 business days, by comparing the day of the week to not be saturday or sunday. change the top two variables to get various different results... if you want to get the next 10 business days, starting in two days from today, change the first variable to 2, and the second to 14. This should yield the next 10 working days. <?php $how_many_business_days_ahead = 0; $how_many_business_days_to_count = 7; for ($i=0;$i<$how_many_business_days_to_count;$i++) { $jump=$i+$how_many_business_days_ahead; $evalday = mktime(strftime ("%d/%m/%Y", strtotime("+$jump days"))); $theday = strftime("%A", strtotime("+$jump days")); if($theday != "Saturday" and $theday != "Sunday") { $days = $how_many_business_days_ahead+$i; $the_days[$j] = strftime("%A, %B %d, %Y", strtotime("+$jump days")); $j++; } } $k = $how_many_business_days_ahead; foreach($the_days as $eachday) { echo "$k business days from now = $eachday<br />"; $k++; } ?> results: 0 business days from now = Tuesday, August 16, 2005 1 business days from now = Wednesday, August 17, 2005 2 business days from now = Thursday, August 18, 2005 3 business days from now = Friday, August 19, 2005 4 business days from now = Monday, August 22, 2005

« previous php.notes (#142010) next »