Rahul Rahul - 2 years ago 136
PHP Question

Add 30 days to date

Hello all i am trying to add 30 days to my date. I am using below coding.

$next_due_date = date('05/06/2016', strtotime("+30 days"));
echo $next_due_date;

But it is returning to "05/06/2016" only!

Please help me!

Answer Source

You need to provide date format like d/m/Y instead of 05/06/2016


$old_date = '05-06-2016';
$next_due_date = date('d-m-Y', strtotime($old_date. ' +30 days'));
echo $next_due_date;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download