1
I have this code that I printed out the dates stipulating the beginning and the end between them:
How would I make the system calculate 15 days after the $dateStart?
For example:
If that was the starting date $dateStart=05/11/2018 the system already stipulated the final date adding the 15 days to stay $dateEnd=19/11/2018
//Star date
$dateStart = '05/11/2018';
$dateStart = implode('-', array_reverse(explode('/', substr($dateStart, 0, 10)))).substr($dateStart, 10);
$dateStart = new DateTime($dateStart);
//End date
$dateEnd = '25/04/2013';
$dateEnd = implode('-', array_reverse(explode('/', substr($dateEnd, 0, 10)))).substr($dateEnd, 10);
$dateEnd = new DateTime($dateEnd);
//Prints days according to the interval
$dateRange = array();
while($dateStart <= $dateEnd){
$dateRange[] = $dateStart->format('Y-m-d');
$dateStart = $dateStart->modify('+1day');
}
foreach ($dateRange as $value) {
echo $value;
}