-1

I m in need of adding a defined value to the date() function. I just want to add 2 more days with the date() function. suppose date("Y-m-d H:i:s"); //2014-06-12 05:38:50 I just want to add 2 more days with the day value which is 12 on above example. can anyone help ?

msahed0
  • 15
  • 4

1 Answers1

1

use php DateTime Object like :

$date = new DateTime();
$date->add(new DateInterval('P2D'));
echo $date->format('Y-m-d H:i:s') . "\n";
Haim Evgi
  • 123,187
  • 45
  • 217
  • 223