Page is a not externally linkable
ahmed24 - 11:05 am on Dec 19, 2012 (gmt 0)
I defined the $start and $end values, then calculated all the dates available between these two dates. Then if each individual date is monday-friday added it to an array called $timestampArray.
All the possible weekdays that fall between the two date ranges are stored in this array as a timestamp. I can then loop through each date and use it for my script.
Heres the code:
$start = "02-DEC-2012";
$end = "13-FEB-2013";
for ($currentDate = strtotime($start); $currentDate <= strtotime($end); $currentDate += (60 * 60 * 24)) {
$day = strtolower(gmdate('D',$currentDate));
$daynumber = gmdate('d',$currentDate);
$month = gmdate('m',$currentDate);
$year = gmdate('Y',$currentDate);
if($day=='mon' || $day=='tue' || $day=='wed' || $day=='thu' || $day=='fri') {
$timestampArray[] = mktime ("8", "00", "00", $month, $daynumber, $year);
}
}