Archive for the 'javascript' Category

Add days to a date in javascript

Wednesday, May 30th, 2007

shiftDay = 10 var myDate = new Date(); myDate.setDate(myDate.getUTCDate() + shiftDay) day   = myDate.getUTCDate() month = myDate.getUTCMonth()*1 + 1 year  = myDate.getUTCFullYear() This code is quite easy: shiftDay hold the number of days you want to add, if you need to go backwards you can set it to a negative value. myDate is set to [...]

Yes !