Answers for "javascript calculate age given date string"

1

javascript calculate age given date string

function getAge(dateString) {
   var ageInMilliseconds = new Date() - new Date(dateString);
   return Math.floor(ageInMilliseconds/1000/60/60/24/365); // convert to years
}
console.log(getAge('1997-04-23'));
Posted by: Guest on May-31-2021
-1

javascript calculate age

calculate Age using Javascript
Posted by: Guest on July-01-2020

Code answers related to "javascript calculate age given date string"

Code answers related to "Javascript"

Browse Popular Code Answers by Language