Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get next week date in javascript

Tags:

javascript

Does anyone know how can I get next week date based on this week date? example if I have this thursday date (25/6/2009) how can I use javascript to get next thursday date (2/7/2009)?

like image 467
Jin Yong Avatar asked Jun 22 '09 06:06

Jin Yong


People also ask

How do I get the next day in JavaScript?

Using setDate() passing the result of <today>. getDate() + 1 , you'll set the day as “tomorrow”.

How do I get this week in JavaScript?

var today = new Date(); var startDay = 0; var weekStart = new Date(today. getDate() - (7 + today. getDay() - startDay) % 7); var weekEnd = new Date(today. getDate() + (7 - today.

How do I get last week Date in react JS?

To get last week's date, use the Date() constructor to create a new date, passing it the year, month and the day of the month - 7 to get the date of a week ago. Copied! function getLastWeeksDate() { const now = new Date(); return new Date(now. getFullYear(), now.


1 Answers

var firstDay = new Date("2009/06/25"); var nextWeek = new Date(firstDay.getTime() + 7 * 24 * 60 * 60 * 1000); 

You can also look at DateJS if you like "fluent" APIs.

like image 198
Matthew Flaschen Avatar answered Oct 04 '22 00:10

Matthew Flaschen