I often come across the need for the following functionality in the Date object in javascript. I believe these are basic functionality that should have been there, but then who cares!! anyone can extend these. So in a series of blogs i will be extending the Date object using the javascript prototype :-)
Functionality | Sample |
Date.AddDay | Date.AddDays Javascript |
Script to AddDays to Date object in javascript
Date.prototype.AddDays = function(noOfDays) {
this.setTime(this.getTime() + (noOfDays * (1000 * 60 * 60 * 24)));
return this;
}
Sample:
No comments:
Post a Comment