Answers for "how to get a person's day of birth and convert it to name on js"

1

javascript get age

function getAge(dateString) 
{
    var today = new Date();
    var birthDate = new Date(dateString);
    var age = today.getFullYear() - birthDate.getFullYear();
    var m = today.getMonth() - birthDate.getMonth();
    if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) 
    {
        age--;
    }
    return age;
}
Posted by: Guest on May-25-2020

Code answers related to "how to get a person's day of birth and convert it to name on js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language