PHP | Add numbers of days to a date
Simple and easy way to add some days in a given date using strtotime() function.
<?php
$p_date = "2019-01-10";
echo date('Y-m-d', strtotime($p_date . ' + 1 days'));
echo date('Y-m-d', strtotime($p_date . ' + 15 days'));
echo date('Y-m-d', strtotime($p_date . ' + 30 days'));
?>
Basically, date_add() function is used for adding some days, months, years, hours, minutes, and seconds to date in PHP.
date_add(object,interval);
<?php
$date=date_create("2019-01-10");
date_add($date,date_interval_create_from_date_string("30 days"));
echo date_format($date,"Y-m-d");
?>