I have this code that printed 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 the start date was this $ dateStart = 05/11/2018 the system already stipulated the end date by adding the 15 days to get $ dateEnd = 19/11/2018 < strong>
//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;
}