JavaScript add days to date

preview_player
Показать описание
How to add days to date?
Let’s define a function addDays.
The function has two parameters: date to be modified and number of days to add.
We use the setDate function to set the new date.
And we use the getDate function to get the current date value.
So we just add the number of days to the current date.
Here it is.
We got a date a week ago.
Рекомендации по теме
Комментарии
Автор

After an hour i found this. Helped 100%

suganyamuthu
Автор

Perfectly working solution this one video helpful than other websites suggested code

janakinaidu_studios
Автор

Thanks a lot man. Better than all I saw on Stackoverflow.

nsikumoh
Автор

Hello, Thank you and greetings from Bulgaria.

Edited: So seems like when you supply a positive number as an argument (1 - 31) it will be taken directly as is. But if you supply a negative number it will be subtracted ?

Thank you.

mocococo