How can I show years and month?
I need to calculate age based on the selected date of birth from the date picker.
But when selecting some date incorrect age displayed.
I have used jquery to calculate to find the age. Sometimes the age is not correct.
I need to show x years and x month old.
When I selecting date like 22-07-2012 show 6 years old.
The actual result is "7 years old"
dob = new Date($("#DateOfBirth").val())
var today = new Date();
var age = Math.floor((today - dob) / (365.25 * 24 * 60 * 60 * 1000));
$('#txtAge').val(age + ' years old');