Javascript Date formatMMDDYYYY()

Description

Javascript Date formatMMDDYYYY()


 Date.prototype.formatMMDDYYYY = function () {
   return this.getMonth() + 1 + '/' + this.getDate() + '/' + this.getFullYear();
};

Date.prototype.formatMMDD = function () {
   return this.getMonth() + 1 + '/' + this.getDate();
};

Date.prototype.addDays = function (days) {
   days = this.getDate() + days;//from  w  ww  .java  2  s .  c  o  m
   return this.setDate(days);
};

Date.prototype.getMonthName = function () {
  var months = ["jan", "feb", "mar", "apr", "may", "june", "july", "aug", "sept", "oct", "nov", "dec"];
  return months[this.getMonth()];
};



PreviousNext

Related