Javascript Date Plus 2 Weeks (14 days)

后端 未结 8 1764
孤街浪徒
孤街浪徒 2020-12-05 17:00

I use this to get the date:

var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFu         


        
8条回答
  •  天命终不由人
    2020-12-05 17:46

    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));
        });
    

提交回复
热议问题