GETDATE() makes an array:
Array
(
[seconds] => 40
[minutes] => 58
[hours] => 21
[mday] => 17
[wday] => 2
[mon] => 6
[year] => 2003
[yday] => 167
[weekday] => Tuesday
[month] => June
[0] => 1055901520
)
and our banners_history_date is in mysql datatime format: 0000-00-00 00:00:00
this is not a good way to do this. use timestamps instead, convert back and forth with strtotime and date functions
at any rate if you subtract 8 days from the current day, you will not start on a sunday unless it was 8 days ago.
here's an unrelated function that I use to determine a future date, maybe it will help in some way.
function futuredate($date, $days) {
/*a mysql type datetime is inputted (YYYY-MM-DD), a date is calculated that is 32 days in the future and converted back to mysql format and returned*/
$date = strtotime(substr($date,0,10));
$date = $date + (86400*$days); //seconds per day times number of days
$date = date("Y-m-d", $date);
return $date;
}