Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

calculate age given the birth date in the format yyyymmdd

const getAge = birthDate => Math.floor((new Date() - new Date(birthDate).getTime()) / 3.15576e+10)

// today is 2018-06-13
getAge('1994-06-14') // 23
getAge('1994-06-13') // 24
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #calculate #age #birth #date #format #yyyymmdd
ADD COMMENT
Topic
Name
8+4 =