jQuery Date Picker Input Date Format
http://stackoverflow.com/questions/11104933/jquery-date-picker-input-date-format
by Rayon Dabre
HTML
<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.21/themes/base/jquery-ui.css">
<input type="text" class="dateofbirthpicker">
<input type="text" id="usia">
JavaScript
$(function() {
$('.dateofbirthpicker').datepicker({
dateFormat: 'yy/mm/dd',
onSelect: function() {
var dob = new Date(this.value);
var today = new Date();
var age = Math.floor((today - dob) / (1000 * 60 * 60 * 24 * 360));
ages = parseInt(age);
$('#usia').val(ages);
}
});
});