Buscar en moleculax
calculateAge

 function calculateAge(fecha_nac) {

    var birthday_arr = fecha_nac.split("-");

    var birthday_date = new Date(birthday_arr[2], birthday_arr[1] - 1, birthday_arr[0]);

    var ageDifMs = Date.now() - birthday_date.getTime();

    var ageDate = new Date(ageDifMs);

    return Math.abs(ageDate.getUTCFullYear() - 1970);

}


var edad = calculateAge("14-03-1965");

console.log(edad);

.


Powered by

http://emiliogomez.com.ar