note 88348 modified in function.date by danbrown

From: Date: Tue, 20 Jan 2009 23:01:58 +0000
Subject: note 88348 modified in function.date by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-149562@lists.php.net to get a copy of this message
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"); ?> --was-- here's a function which creates a list of workingday dates 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"); http://php.net/manual/en/function.date.php

« previous php.notes (#149562) next »