I wrote this piece of code
echo date("Y-m-d", strtotime($date, strtotime("+ " . $days . " days")));
$date = 2012-04-12
$days = 15
I am looking to add $days
(15 days) to the date (2012-04-12
) I am expecting to get 2012-04-27
and this code returns me 2012-04-12
, what am I doing wrong?
strtotime()
is not unreliable; in fact, DateTime class uses it under the sheets. – Encircle