I am developing a small application with PHP
and HTML
, and I see myself in need of changing the format of <input type="date"/>
since it is the English format and I need it in Spanish.
I have no idea how to do it, I've read that using date_format($fechaNacimiento, 'd/m/y')
that function or also using the date function like this:
$fecha = new DateTime('2017-02-01');
$fecha_m_d_y = $fecha->format('d/m/Y');
echo $fecha_m_d_y;
But neither of them I have been able to apply them, because I need to apply it to $_POST
and for these functions they are string
, and I do not know how to pass the $_POST
to string
. Attachment code
HTML and PHP
<tr>
<td>Fecha Nacimiento:</td>
<td><input type="text" name="jug_fec_nac" id="jug_fec_nac" value="<?php echo date_format($fechaNacimiento, 'd/m/y');
?>"/></td>
</tr>
Definition of variables
$fechaNacimiento = $_POST['jug_fec_nac'];
That returns the date with English format ( 2017/05/31
) and I need it to receive it by the $_POST
change it to ( 31/05/2017
)