Last active
August 16, 2016 12:35
-
-
Save mohitesachin217/06d1cd48c5958908eaeedb29f34eee61 to your computer and use it in GitHub Desktop.
get age from date of birth javascript code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getAge(birth) { | |
ageMS = Date.parse(Date()) - Date.parse(birth); | |
age = new Date(); | |
age.setTime(ageMS); | |
ageYear = age.getFullYear() - 1970; | |
return ageYear; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment