I'm using the following script to calculate age in (years). This code returns the result as 17 before 12pm and after 12pm it returns as 18.
$(document).ready(function () {
var dobAge = 03 + "/" + 21 + "/" + 1996;
dobAge = new Date(dobAge);
var today = new Date();
age = Math.floor((today - dobAge) / (365.25 * 24 * 60 * 60 * 1000));
alert(age);
});
I want this code to return 18 after 12am itself. How is that possible? Please help.