Menu
Hi – This function was supposed to calculate the next delivery date based on a start date and by adding 2, 4, 6 or 8 week intervals until past “today”. I’ve done something wrong because it seems to just be adding intervals from “today”.
[code=php]function next_shipment($start_date, $freq) {
//for $start_date use date format 2012/12/30 = year/day/month
$start = strtotime(“$start_date”);
while ( $start <= strtotime(‘today’)) { $start = strtotime(“$start + $freq weeks”); }
$next_delivery=$start;
echo date(‘l F j, Y’, $next_delivery);
}