Contact Form - Send date 0000-00-00

1

Good morning, I made a contact form and I put one but when I put the date right example: 08/31/2017, I click to send the date comes as: 2017/08/31, I would like to leave as default of Brazil .

My input:

<input type="text" onfocus="(this.type='date')" name="datadenascimento" id="datadenascimento" class="gui-input" placeholder="Data de Nascimento">

The sending string:

$datadenascimento = strip_tags(trim($_POST["datadenascimento"]));
    
asked by anonymous 31.08.2017 / 14:30

1 answer

1

Use the "date_formate" of php itself!

$data = $_POST['datadenascimento'];
$data_cria = new DateTime($data);

$data_formata = $data_cria->format('d/m/Y');

Read more here

    
31.08.2017 / 14:42