How can I add the dates in datepicker I selected.
example I selected 01/06/2018 and I want to add 5 days on it , so the result will be 06/06/2018
but I always get invalid date.
var d1 = new Date($('#dte').val());
var end = d1 + $('#numberToAdd').val();
console.log(end) //invalid date;
please help me .
01 + 5 = 11???
Anyhow - when you have a date object, get the day using getDate() and use setDate() to set it with the added 5.
var d = new Date("2018-06-27");
d.setDate(d.getDate() + 5);
// Mon Jul 02 2018 12:00:00
Thank you, sorry for that 11 result hehehehe…can I ask is it possible to exclude the weekend ?
You could certainly do that by adding 7 instead of 5.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.