0

I need a birthday field with format "0000/00/00". I have one field with format "MM/DD/YYYY" but doesn't work in MySQL when I insert something.

There is the code:

<div class="form-group">
    <label for="birthDate" class="col-sm-3 control-label">Date of Birth</label>
    <div class="col-sm-9">
       <input type="date" id="birthDate" class="form-control">
    </div>
</div>
Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43
rashid
  • 15
  • 4
  • Possible duplicate of [How to set date format in HTML date input tag?](https://stackoverflow.com/questions/6978631/how-to-set-date-format-in-html-date-input-tag) – BenM Jun 16 '17 at 11:30
  • where's your insert code? Also - phpmyadmin is irrelvant - data enters mysql the same way no matter your prefered mysql ui – treyBake Jun 16 '17 at 11:30
  • I think your answer is [here](https://stackoverflow.com/questions/3496241/specifying-the-value-output-of-of-an-html5-input-type-date) – Rui Silva Jun 16 '17 at 11:33

1 Answers1

0

Your datetime format i.e. MM/DD/YYYY is different from the mysql default format. The default format is:

Y-m-d H:i:s

So change it to like:

date('Y-m-d',strtotime($yourDate));
Mayank Pandeyz
  • 25,704
  • 4
  • 40
  • 59