I'm sorry i'm currently having a problem on this section. My Date format is Y-m-d
$date1 = '2016-03-1';
$date2 = '2016-07-1';
$date3 = '2016-10-1';
$date4 = '2016-12-1';
if today is 2016-8-12 it should fall at $date3 since it the next period. i tried using the if conditions but it only falls at first condition. Can you enlighten me on this?
My code is somewhat like this
$today = date("2016-07-29");
if(strtotime($date1) < strtotime($today)){
$next_accrual_date = $date1;
$date_condition = 'condition 1';
}else
if(strtotime($date2) < strtotime($today)){
$next_accrual_date = $date2;
$date_condition = 'condition 2';
}else
if(strtotime($date3) < strtotime($today)){
$next_accrual_date = $date3;
$date_condition = 'condition 3';
}else
if(strtotime($date4) < strtotime($today)){
$next_accrual_date = $date4;
$date_condition = 'condition 4';
}
echo $next_accrual_date." falls to ".$date_condition;