I am using date picker for the birth date selection.
and I have three input box.
after enter 31/08/1991
birthdate auto calculate year month and days like 21 year
1 months
2 Days
.
$(function() {
$("#dob").datepicker({
changeMonth : true,
changeYear : true,
defaultDate: '-30yr',
yearRange: 'c-25:c+35',
onSelect: function(selectedDate) {
var a = $("#dob").datepicker( "getDate" );
var today = new Date();
var age = Math.floor((today-a) / ( 24 * 60 * 60 * 1000 ));
var year = Math.round(age/365);
var month = Math.round(age/30);
$('#ages').val(year);
}
});
$("#dob").datepicker("option", "dateFormat", 'dd-mm-yy');
$("input:submit, a, button", ".registerSubmit").button();
});