2808 explained code solutions for 75 technologies


nodejsHow to add months to date


let dt = new Date();
dt.setMonth(dt.getMonth() + 4);ctrl + c
new Date

create date/time management object

.setMonth(

sets months for the given date object

getMonth()

returns months of the date

dt.getMonth() + 4

adds 4 months to the given date

4

number of months to add