Calculate Birthdate from given age using javascript -


how can calculate birthdate given age using javascript.

example:

i entering age 23 years 1 month 26 days.

then need birthdate 1995-05-30.

how can done.

if working dates, recommend using moment library:

https://momentjs.com/

using moment can subtract intervals dates. example:

moment().subtract(10, 'days')

in case:

var bday = moment().subtract(23, 'years'); bday.subtract(1, 'months'); bday.subtract(26, 'days'); 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -