I am getting a date from an XML file which is found in the following way in the 2019-05-13T16:02:16.
After obtaining this date in a PHP variable I save it in a table in SQL, to give the date a correct format and that only the date is stored like this without time, I am doing the following:
$xml = new SimpleXMlElement( $_FILES['XmlToUpload']['tmp_name'], 0, true );
$fechaCadena = strtotime("21/05/2021");
$fechaEntrada = getdate($fechaCadena);
$fechaEntrada = $xml['Fecha'];
When reviewing the date in the table, it is saved in the following format:
2019-05-13
What I would like is to convert this date into the following format:
dd/mm/yyyy
I tried before by replace
changing the '-'
by '/'
but it still didn't work
$fechaCadena = strtotime(str_replace('-', '/',"21/05/2021"));
I would like someone to give me a little more guidance on how to correctly convert the date to the format I want.