note 88348 deleted from function.date by derick
| From: | derick@php.net | Date: | Sun, 22 Mar 2009 18:44:37 +0000 |
| Subject: | note 88348 deleted from function.date by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-152293@lists.php.net to get a copy of this message | ||
Note Submitter: DaanK Interworking (daniel at daank dot nl)
----
here's a function which creates a list of workingday dates
<?php
function calculateWorkingDays($fromDate,$tillDate) {
$arrDatumRange = range(
strtotime($fromDate) ,
strtotime($tillDate) ,
(3600*24)
);
foreach ($arrDatumRange as $key=>$iTime) {
if (date("N",$iTime) != 6 && date("N",$iTime) != 7) {
$arrDatumRange[$key] = date("j-n-Y",$iTime);
} else {
unset ($arrDatumRange[$key]);
}
}
return $arrDatumRange;
}
// Example:
$arrWorkingDayDates = calculateWorkingDays("20-1-2009","19-4-2009");
?>