Answer the question
In order to leave comments, you need to log in
How to add one day to a date?
Tell me why it works and adds 1 day,
var timeend2 = new Date(2018,01,31);
alert(timeend2);
timeend2.setDate(timeend2.getDate() +1);
but alert shows
Sat Mar 03 2018 00:00:00 GMT+0200
var timeend2 = new Date();
timeend2.setDate(timeend2.getDate() +1);
if so, then 1 day does not add
Answer the question
In order to leave comments, you need to log in
var secoffs = 24 * 60 * 60 * 1000;
var vof = timeend2.valueOf();
var i = 1; // one day
var newdate = new Date(vof + (secoffs * i));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question