Return Age from Date of Birth


/ Published in: JavaScript
Save to your folder(s)

Calculates the amount of time since the date specified with yr, mon, and day. The parameter "countunit" can be "years", "months", or "days" and is the duration between the specified day and today in the selected denomination. The "decimals" parameter allows you to set a decimal place to round to for days and months return values. Rounding is also meant for days and months and can be "roundup" or "rounddown" based solely on the properties of Math.ceil and math.floor respectively.
Sample - displayage(1997, 11, 24, "years", 0, "rounddown")

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.