We all have to make forms in html or php from time to time.  Recently I can across the issue where I inserted a date field for birthdays and then the user had to type the date manually.  This is very bad UX since there is a possibility of formatting errors and the user simply not motivated to type out a whole date range.  Get all the datepicker option below.

Datepicker option is best

So a pop-out datepicker is the best option since it gives the user a graphic interface and the formatting happens from the browser side.  And it works well on mobile.

Get the demo and all the possible coding options from  The highlight that I found most useful are below.

Datepicker code

So you have code below.  Add it at the top of the page or form or in the header of your page.

<script src=""></script>
<script src=""></script>
$( function() {
$( "#contact_birth_date" ).datepicker();
} );
Your #datepicker is your form input field.  So your can change that how it appears in your database or form.

Styling your Datepicker

Remove any form styles that exist on your form so that there are no CSS that clash..  And insert these two links to style sheets.

<link rel="stylesheet" href="//">
<link rel="stylesheet" href="/resources/demos/style.css">

Year range for your picker

So you want to add the year range to your datepicker.  See the highlighted code below.

$( function() {
$( “#contact_birth_date” ).datepicker({
      changeMonth: true,
      changeYear: true,
      yearRange: ‘1950:2013’
} );

This lets users to choose year and month from a drop down. See below.


More options

Get the demo and all the possible coding options from