I have date and time format datetimepicker. I would like to add number of days to the datetime
inputdattime will be picked from datetimepicker
input datetime = Friday, October 23rd 2015, 12:00:00 am
output should be if i add 2 days sunday, oct 25 2015 12:00:00 am
how to achieve this
var deal_from_date = new Date();
var numberOfDaysToAdd = 7;
var date1 = deal_from_date.setDate(deal_from_date.getDate() + numberOfDaysToAdd);
actual Output should be
"dddd, MMMM Do YYYY, h: mm:ss a"
Sun Oct 25 2015 12:00:00
current output is:
Sun Oct 25 2015 12:54:06
setDate()
method can be used to add days to a date
var today=new Date('23/10/2015');
var in_a_day=new Date(today).setDate(today.getDate()+2);
Try this code :-
var d = new Date('oct 25 2015 12:00:00 pm');
d.setDate(d.getDate() + 2)
alert(d);
output is :- Tue Oct 27 2015 12:00:00 GMT+0530 (IST)