I have dates stored in array for completion status of projects like below
The first two letters are months and other four letters are years
052012(mmyyyy)
$arrDates = array('052012', '042013', '082013', '122013', '022014');
I want this array To get converted to wordings as below
$arrDates = array('Completed', 'Next Six Months', 'Next Year', 'Next Year', 'After 2 Years');
I used a for loop like below for checking completed as below
for($i=0;$i<count($arrDates);$i++)
{
if((date('m') > substr($arrDates[$i], 0,2)) && (date('y') == substr($arrDates[$i], 2,6)))
$strStatus = ' Completed';
}
and I messed up in finding for next year and other two.
Could some one help me in fixing this?
I think you can use
DateTimeanddateIntervalfor this :