I had a vaccines it has to give at 2months,4months and at 6months.I need to calculate based on the Date of Birth as
EX:if the DOB:18-03-2015 and in due date section it has to show for 2months date as 18-05-2015. After the date completed it has to update automatically and change it to 4 months date as 18-07-2015.
I tried but it has not worked and it has to check with present date also.
How to do this Please help me.
My code:
<?php
$date=date_create("now");//present date
$bdate=date_create($myDate);//Birthday date
//echo date_format($bdate,'d-m-Y');
if($date >= $bdate)
{
$hadueDate=$bdate->modify('+2 month');//due date
echo date_format($hadueDate,"d-m-Y");
}
else
{
$bdate->modify('+4 months');
echo date_format($bdate,'d-m-Y');
}
?>