T
Trevor Lawrence
This is a JS question
I am trying to add to a date
This is my code
var firstdate = new Date()
firstdate.setFullYear(2007,10,26)
var number = 1
var newdate = new Date()
newdate.setDate(firstdate.getDate() + number)
alert('firstdate= ' + firstdate + '\nnewdate= ' + newdate)
The alert shows that 1 month and 1 day is added to the date, not 1 day
e.g
firstdate = Mon Nov 26 17:08..... 2007
nwedate = Thurs Dec27 17:08.... 2007
How do I add a specified number of days to the date?
I am trying to add to a date
This is my code
var firstdate = new Date()
firstdate.setFullYear(2007,10,26)
var number = 1
var newdate = new Date()
newdate.setDate(firstdate.getDate() + number)
alert('firstdate= ' + firstdate + '\nnewdate= ' + newdate)
The alert shows that 1 month and 1 day is added to the date, not 1 day
e.g
firstdate = Mon Nov 26 17:08..... 2007
nwedate = Thurs Dec27 17:08.... 2007
How do I add a specified number of days to the date?