Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get age by birthday js

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;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript truncate string 
Javascript :: array to comma separated list js 
Javascript :: js download json 
Javascript :: laravel 8 include javascript in blade 
Javascript :: regex find img tag 
Javascript :: fs write stream append 
Javascript :: jquery scroll to element 
Javascript :: once content is loaded run part of code 
Javascript :: append to array check if exists javascript 
Javascript :: js cleartimeout 
Javascript :: loopback geopoint 
Javascript :: express js example 
Javascript :: center horizontally react native 
Javascript :: parsley cdn 
Javascript :: router-link vue 
Javascript :: how to get the extension from filename using javascript 
Javascript :: fetch request to GraphQL 
Javascript :: valid filename regex 
Javascript :: google charts hide legend 
Javascript :: formdata appen array of strings 
Javascript :: set dropdown value using jquery 
Javascript :: javascript loop thrown object 
Javascript :: serve a file in express 
Javascript :: refreshing a page with jquery 
Javascript :: mysql get json value by key 
Javascript :: javascript reverse array without modifying 
Javascript :: node redisjson remove path 
Javascript :: js element.scrollintoview navbar 
Javascript :: how to hide mouse pointer in javascript 
Javascript :: remove value from array javascript 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =