N
N
nikitoshq2020-11-05 12:03:14
JavaScript
nikitoshq, 2020-11-05 12:03:14

How to add a week to a date and display it in the format?

There is a date in this format "2020-11-30". You need to add a week to it and output in the same format "yyyy-mm-dd".

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2020-11-05
@nikitoshq

new Date(Date.parse('2020-11-30') + 7 * 24 * 60 * 60 * 1000)

UPD,
Or like this:
const d = new Date('2020-11-30')
d.setDate(d.getDate() + 7)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question