Avatar of Žan Anđić
Žan Anđić
Flag for Bosnia and Herzegovina

asked on 

Input date format yyyy-mm-dd


I have little problem with date picker in html input field.
When I choose date from picker it show in this format: dd.mm.yyyy but when that record save to database MySQL shows like this:
yyyy-mm-dd , what is the best way to make this working, to write in database date in this format dd.mm.yyyy

there is html:

<label>Date of birth:</label>
<input type="date"  class="form-control" name="date_birth" required />

Open in new window


I am fix that using date("d.m.Y",strtotime($_POST['datum_rodjenja']));

Avatar of undefined
Last Comment
Julian Hansen

8/22/2022 - Mon