Javascript Date addDays(days)

Description

Javascript Date addDays(days)


Date.prototype.addDays = function(days)
{
    var dat = new Date(this.valueOf());
    dat.setDate(dat.getDate() + days);//from   w  ww . j  av a  2  s .  c  o m
    return dat;
}

Javascript Date addDays(days)

/*/*from   w ww . j  a va 2 s.  com*/
 * Use for add days to current date time
 *
 * Usage: var dat = new Date();
 *              console.log(dat.toJSON())
 *
 */

Date.prototype.addDays = function(days)
{
  var dat = new Date(this.valueOf());
  dat.setDate(dat.getDate() + days);
  return dat;
}

Javascript Date addDays(days)

/**//from ww w  . ja v a 2s .  c  o m
* Add days into object DATE
*
* @param   {number} Number of days added to DATE, can be +/-
*/
Date.prototype.addDays = function(days) {
  days = parseInt(days);
  this.setDate(this.getDate() + (days  || 0));
  return this;
}

Javascript Date addDays(days)

"use strict";/*from ww  w .  j a v a 2 s.c  o m*/

Date.prototype.addDays = function (days) {
 var d = this.getDate() + days;
 this.setDate(d);
 return this;
};

Javascript Date addDays(days)

Date.prototype.addDays = function(days)
{
    var dat = new Date(this.valueOf());
    dat.setDate(dat.getDate() + days);// w  w w . ja  va 2 s .  com
    return dat;
}

Javascript Date AddDays(days)

Date.prototype.AddDays = function (days) {
 this.setDate(this.getDate() + parseInt(days));
  return this.getFullYear() + "-" + (((this.getMonth()+1) < 10)?"0":"") + (this.getMonth()+1) +"-"+ ((this.getDate() < 10)?"0":"") + this.getDate();
}



PreviousNext

Related