2
$data = $_POST["data"];
// Recebe a variável com a data, e cria um objeto DateTime a partir do formato especificado.
$objetoData = DateTime::createFromFormat('d/m/Y', $data);
// Reformata a data do jeito desejado
$data = $objetoData->format('Y-d-m');
I have this function where it changes the date to the format I want. Example the date enters as 12/13/2018 and when pass the exit function 2018-12-13.
The problem is that the function is only worked for old dates using the example above only works from day 12 behind day 13 q the current it shows another date that would be 2019-12-01.