fork download
  1. <?php
  2.  
  3. $dataInicial = "18/10/2017";
  4. $dias = 7;
  5.  
  6. // Criar o objeto representando a data
  7. $obj_data = DateTime::createFromFormat('d/m/Y', $dataInicial);
  8. $obj_data->setTime(0, 0, 0);
  9.  
  10. $intervalo = new DateInterval("P{$dias}D");
  11. $obj_data->add($intervalo);
  12.  
  13. // Formatar a data obtida
  14. echo $obj_data->format('d/m/Y');
Success #stdin #stdout 0.01s 83904KB
stdin
Standard input is empty
stdout
25/10/2017