I am using datepicker for my input name birth_day. And I want to calculate the age from the current year and selected year.
current_yr - selected_yr
but I have no idea on how can I get the selected year from date picker.
this is my code look like.
<script>
function dateYear(){
var d = new Date();
var year = d.getFullYear();
return year;
}
$(function() {
$( "#id_birth_date" ).datepicker({ dateFormat: 'yy-mm-dd' });
//how can I get the selected year?
});
</script>
<input type="text" name="birth_day" id="bd">
<input type="text" name="age" id="ag">
does anyone can give me an idea about my case?
any help will be appreciated …
thanks in advance
Do you mean: