Find existing days between two predefined dates

Asked

Viewed 19 times

0

I am implementing a system of calendars used for marking warnings in PHP with Codeigniter.

I would like to know how I can pick up every existing day between two predefined dates, for example:

// $result[0]->datainicio_turma = 2021-02-07 00:00:00.0
// $result[0]->datafim_turma = 2021-02-14 00:00:00.0

$result = $this->tm->getDadosMontaTurma($codturma);
$diferenca = strtotime($result[0]->datafim_turma) - strtotime($result[0]->datainicio_turma);
$intervalo = floor($diferenca / (60 * 60 * 24))+1;

The floor function returns me the amount of days existing (8 days), however I need to know exactly which existing days, example:

array(8) 
 { 
   [0]=> string(8) "07/02/21" 
   [1]=> string(8) "08/02/21" 
   [2]=> string(8) "09/02/21" 
   [3]=> string(8) "10/02/21" 
   [4]=> string(8) "11/02/21" 
   [5]=> string(8) "12/02/21" 
   [6]=> string(8) "13/02/21" 
   [7]=> string(8) "14/02/21" 
}
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.