e.g:
for the start of this week, (Mon 7th July), it will print the following:
Which is all ok, but what Id like to also do is populate an array with the dates between (and including) the dates abovecall_date >= '07 July 2003' AND call_date < '14 July 2003'
e.g:
Hope you understand what Im trying to achieve.07 July 2003
08 July 2003
09 July 2003
10 July 2003
11 July 2003
12 July 2003
13 July 2003
14 July 2003
Cheers
Santos
Code: Select all
<?
define("SECONDSINWEEK", 604800); // Number of seconds in week
define("SECONDSINDAY", 86400); // Number of seconds in day
$iDayOfWeek = 1; // 0 to 6 - 0 being Sunday
$iNumWeeks = 12; // Number of weeks to lookback
$iOffsetTimestamp = 0; // Initialize this var
$iCurTime = time();
$iCurDay = date("w", $iCurTime);
if ($iCurDay > $iDayOfWeek){ //if we already passed the day we're looking for
$iOffsetTimeStamp = $iCurTime - (SECONDSINDAY * ($iCurDay - $iDayOfWeek) );
}else if($iCurDay == $iDayOfWeek){ //if we're on the day we're looking for
$iOffsetTimeStamp = $iCurTime;
}else{ //if the day we're looking for hasn't come up yet
$iOffsetTimeStamp = ($iCurTime + (SECONDSINDAY * ($iDayOfWeek - $iCurDay) ) ) - SECONDSINWEEK;
}
?>
<b>Week Starting:</b><p>
<?php
for ($i =0; $i < $iNumWeeks; $i++)
{
if(stripslashes($_POST['sdate']) == "call_date >= '" . date("d F Y", $iOffsetTimeStamp - ($i * SECONDSINWEEK) ) . "' AND call_date < '" . date("d F Y", ($iOffsetTimeStamp + SECONDSINWEEK) - ($i * SECONDSINWEEK) ) . "'"){
echo date("d F Y", $iOffsetTimeStamp - ($i * SECONDSINWEEK) ) . "<br>\n";
}else{
echo date("d F Y", $iOffsetTimeStamp - ($i * SECONDSINWEEK) ) . "<br>\n";
}
}
?>
</select>