How can I calculate a range of dates, for example: 08/24/2017 and 09/05/2017 and get the total amount of days?
For example the result of this difference would have to give 106 days difference from one date to another
code:
$data = $row['data'];
$data_inicio = $row['data_inicio'];
$now = time();
$date1 = date("Y-m-d", $now);
$time_inicial = geraTimestamp($date1);
$time_final = geraTimestamp($data);
$diferenca = $time_final - $time_inicial;
$dias = (int)floor($diferenca / (60 * 60 * 24));
$d2 = geraTimestamp($data_inicio);
$diff = $time_inicial - $d2;
$diasC = (int)floor($diff / (60 * 60 * 24));
$conta = ($dias * 100) / $diasC;
$result = number_format($conta,2);