I'm trying to print the date for the last 30 days from today. It goes fine until it hits the start of the month where it goes awol. Can someone explain this or show how it should be done? Code: var today= new Date(); var tempDate= new Date(); for(var i=0;i<30;i++) { tempDate.setDate(today.getDate()-i); console.log(tempDate); } this outputs: Wed Dec 09 2009 19:07:07 ...