How can I add years to a date String in JavaScript?
Example:
var date = "01/01/1983"
I would like to add 26 to "1983". The result should be this "01/01/2009" String.
Could this be done with a replace() method instead of new Date()?
How can I add years to a date String in JavaScript?
Example:
var date = "01/01/1983"
I would like to add 26 to "1983". The result should be this "01/01/2009" String.
Could this be done with a replace() method instead of new Date()?
var parts ='01/01/1983'.split('/');
var mydate = new Date(parseInt(parts[2]) + 1, parts[1] - 1, parts[0]);
console.log(mydate.toDateString())