0
Good evening everyone, I am developing a project in which I Charge accounts in batch depending on the amount of months that the user selects being at most 12 months, ok the CRUD of these accounts, already working perfectly, I created a for that counts how many months is to be generated the account and will add +1 Month to the due date, the first maturity is legal, but the next dates appear truncated seems follows the code to generate in batch and the display of records on the screen
EXCERPT FROM THE CODE
public function gerarLote($meses){
$conexao = new Conexao();
$vencer = new DateTime($this->getVenc());
for ($i=0; $i < $meses; $i++) {
$this->insert();
$vencer->modify('+1 month');
$this->setVenc($vencer->format("d/m/Y"));
}
return true;
}
Display of records on the screen with reference to "JIU MONTHLY PAYMENT"
From now on I appreciate any help
I got a little lost where I put it? when I pick up the form data I pick up as datetime? and my get is not so getData() I would have to put inside the parentheses
– Matheus Mancini
Do I hear getVenc() like this? $this->setVenc(print($_Datavenc->getData()->format("d/m/Y")."<br>"); and instanceLote() $win = new Calendar(); $_Datavenc->setData("2018-10-15"); ?
– Matheus Mancini
Luiz Alberto left the function gerarLote(); thus
public function gerarLote($meses){

 $conexao = new Conexao();

 $vencer = new Calendario();

 $vencer->setData("2020-01-07");

 $this->setVenc($vencer->getData()->format("d/m/Y"));

 for ($i=0; $i < $meses; $i++) { 

 $this->insert();
 
 $vencer->adicionarMeses(1);

 }

 return true;
 }
– Matheus Mancini
can’t put my formatted code in the comments wanted to put the image also of what Luis Alberto guided
– Matheus Mancini
of the ERROR I cannot store a Datetime object as a string
– Matheus Mancini
Is it possible to put image in the comments? very complicated to move here :(
– Matheus Mancini
Guys, I managed to solve seven format in this way $this->setVenc($vencer->format( Datetime::ISO8601));
– Matheus Mancini