Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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'));
Comment

PREVIOUS NEXT
Code Example
Javascript :: console log add new line 
Javascript :: js get timezone name 
Javascript :: javascript on double click 
Javascript :: open url in new tab javascript 
Javascript :: sequelize like search 
Javascript :: jquery back button event 
Javascript :: js change contenteditable value 
Javascript :: npm react router dom@5 
Javascript :: react native text area form 
Javascript :: javascript get 7 days from now 
Javascript :: increase font size chartjs 
Javascript :: remove word from string javascript 
Javascript :: wait until foreach is done javascript 
Javascript :: Exceeded maximum budget Budget 10 kB was not met by 478 bytes with a total of 10.5 kB. 
Javascript :: set port nextjs 
Javascript :: unset radio button jquery by name 
Javascript :: react eslint error missing in props validation 
Javascript :: material ui multiline 
Javascript :: expo build apk 
Javascript :: remove object from array of objects based on object property javascript 
Javascript :: javascript image xss 
Javascript :: javascript json foreach value 
Javascript :: eslint disalbe check next line 
Javascript :: how to find factorial of a number in javascript 
Javascript :: image next src url 
Javascript :: how to find next multiple of 5 in javascript 
Javascript :: install node js windows powershell 
Javascript :: javascript alerter 
Javascript :: react native detect production 
Javascript :: javascript regex number 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =