Set day for Date - Node.js Date

Node.js examples for Date:Day

Description

Set day for Date

Demo Code


Date.prototype.setDay = function (day) {
    var d = this.getDay();
    if (this.firstDayOfWeek == 1 && d == 0) {
        d = 7/*ww  w  . j  a  va 2  s  .  com*/
    };
    this.setDate(this.getDate()+(day-d));
}

Related Tutorials