Skip to content

Instantly share code, notes, and snippets.

@danieleli
Created December 24, 2011 21:05
Show Gist options
  • Select an option

  • Save danieleli/1518342 to your computer and use it in GitHub Desktop.

Select an option

Save danieleli/1518342 to your computer and use it in GitHub Desktop.
Javascript Date Extensions
Date.prototype.formatMMDDYYY = 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;
return this.setDate(days);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment