Javascript Date Plus 2 Weeks (14 days)
have made a fidle for you http://jsfiddle.net/pramodpv/wfwuZ/
Date.prototype.AddDays = function(noOfDays) {
this.setTime(this.getTime() + (noOfDays * (1000 * 60 * 60 * 24)));
return this;
}
Date.prototype.toString = function() {
return this.getMonth() + "/" + this.getDate() + "/" + this.getFullYear().toString().slice(2);
}
$(function() {
var currentTime = new Date();
alert(currentTime.AddDays(14));
});
Try this:
currentTime.setDate(currentTime.getDate()+14);
var currentTime = new Date();
currentTime.setDate(currentTime.getDate()+14);
12096e5
is a magic number which is 14 days in milliseconds.
var fortnightAway = new Date(Date.now() + 12096e5);
jsFiddle.