Am using the following for my date in javascript
I would like to get a date plus 1 more day
so i have
new Date(2018, 1, 12, 10, 30)
THe above creates a date on 12th
Now i would like to get a date 1 week from todat
How do i go about it using Date
Am using the following for my date in javascript
I would like to get a date plus 1 more day
so i have
new Date(2018, 1, 12, 10, 30)
THe above creates a date on 12th
Now i would like to get a date 1 week from todat
How do i go about it using Date
A very simple (but ugly) way to do it.
new Date(Date.now() + 604800000);
I guess you could just go:
var date = new Date(2018, 1, 12, 10, 30);
date.setDate(date.getDate() + 7);
You can follow the direction of this StackOverflow post: how to get next week date in javascript
Or you can use a library like Moment.js to make everything extremely simple for you:
moment().add(7, 'days').toDate();