JavaScript interpreter actually thinks of a date as the number of milliseconds that have passed since midnight on January 1, 1970. For example, Wednesday, February 1, 2012 is actually 131328083200000 to the JavaScript interpreter (funny eh?).
So, to create a date that’s one week from now, you could do the following:
var now = new Date(); // today var nowMS = now.getTime(); // get # milliseconds for today var week = 1000*60*60*24*7; // milliseconds in one week var oneWeekFromNow = new Date(nowMS + week);
The first line stores the current date and time in a variable named now. Next, the getTime()method extracts the number of milliseconds that have elapsed from January 1, 1970 to today. The third line calculates the total number of milliseconds in a single week (1000 milliseconds * 60 seconds * 60 minutes * 24 hours * 7 days). Finally, the code creates a new date by adding the number of milliseconds in a week to today.
I took this example from Javascript & jQuery: The Missing Manual, by David Sawyer book. Hope it helped!