Get week day's name - Node.js Date

Node.js examples for Date:Week

Description

Get week day's name

Demo Code

//n.b. this is sooo not i18n safe :)
Date.prototype.getDayName = function () {
    switch (this.getDay()) {
        case 0: return 'Sunday';
        case 1: return 'Monday';
        case 2: return 'Tuesday';
        case 3: return 'Wednesday';
        case 4: return 'Thursday';
        case 5: return 'Friday';
        case 6: return 'Saturday';
    }//from w  ww .  j  a v a 2  s.  c  o  m
};

Related Tutorials