I am trying to output a number of months using days(value fro $daydiff).
Whole code goes like:
$ArrivalDate = $variants_data['ArrivalDate'];
$daydiff=floor((abs(strtotime(date("Y-m-d")) - strtotime($ArrivalDate))/(60*60*24)));
if (!empty($daydiff) && $ArrivalDate == '2013-12-25') {
$ETA ='Date Not Confirmed';
}
elseif (!empty($daydiff) && is_null($ArrivalDate)) {
$ETA ='Not available';
}
elseif ( $daydiff > 30 && $daydiff < 60 ) { // anything between 31 and 59 days is 1 month
$ETA ='1 Month';
}
elseif ( $daydiff > 60 && $daydiff < 90 ) { // anything between 61 and 89 days is 2 months
$ETA ='2 Months';
}
else
{
$ETA ='';
}
This section of code doesn't give me required results
elseif ( $daydiff > 30 && $daydiff < 60 ) { // anything between 31 and 59 days is 1 month
$ETA ='1 Month';
}
elseif ( $daydiff > 60 && $daydiff < 90 ) { // anything between 61 and 89 days is 2 months
$ETA ='2 Months';
}
else
{
$ETA ='';
}
I get 'Date Not Confirmed' as results. Required result is '1 month' or '2 months' if the $daydiff value falls in the range.
What am I doing wrong here?