2808 explained code solutions for 75 technologies


nodejsHow to add years to date


let dt = new Date();
dt.setFullYear(dt.getFullYear() + 5);ctrl + c
new Date

create date/time management object

.setFullYear(

sets year for the given date object

getFullYear()

returns year of the date

dt.getFullYear() + 5

adds 5 years to the given date

5

number of months to add