Skip to content
Advertisement

how to get next week date in 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)?

Advertisement

Answer

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.

Advertisement