function getAge(dateString) //pass your dob here { var today = new Date(); var birthDate = new Date(dateString); var age = today.getFullYear() - birthDate.getFullYear(); var m = today.getMonth() - birthDate.getMonth(); if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) { age--; } return age; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)