Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get age using moment

var a = moment();
var b = moment('{dem_pat_birthyear}', 'YYYY');  
var diff = a.diff(b, 'years'); // calculates patient's age in years
diff; // this prints out the age
//In this calculation {dem_pat_birthyear} 
//needs to be replaced with your variable name for birth year. 
 
PREVIOUS NEXT
Tagged: #age #moment
ADD COMMENT
Topic
Name
2+2 =