I am calculating the age from jquery datepicker. But this works when only the date is in(mm/dd/yy)
format. I need to get this working in dd/mm/yy
.
//Code
$('#dob').datepicker({
onSelect: function(value, ui) {
var today = new Date(),
dob = new Date(value),
age = new Date(today - dob).getFullYear() - 1970;
$('#age').text(age);
},
maxDate: '+0d',
yearRange: '1920:2010',
changeMonth: true,
changeYear: true
});
If i try to set dateFormat: 'mm/dd/yy'
in the property this wont work.
Any help?