Nodejs Day Name getDayName()

Here you can find the source of getDayName()

Method Source Code

Date.prototype.getDayName = function(){
  return {//  w  ww . ja v a2s . com
      0: 'Sunday',
      1: 'Monday',
      2: 'Tuesday',
      3: 'Wednesday',
      4: 'Thursday',
      5: 'Friday',
      6: 'Saturday'
  }[this.getDay()];
};

Date.prototype.getMonthName = function(){
  return {
      0: 'January',
      1: 'February',
      2: 'March',
      3: 'April',
      4: 'May',
      5: 'June',
      6: 'July',
      7: 'August',
      8: 'September',
      9: 'October',
     10: 'November',
     11: 'December'
  }[this.getMonth()];
};

Related

  1. getDayName()
    Date.prototype.getDayName = function() {
      var d = ['Sunday','Monday','Tuesday','Wednesday',
               'Thursday','Friday','Saturday'];
      return d[this.getDay()];
    
  2. getDayName()
    Date.prototype.getDayName = function () {
      var map = ['sun', 'mon', 'tue', 'wed', 'thr', 'fri', 'sat'];
      return map[this.getDay()];
    };
    
  3. getDayName()
    Date.prototype.getDayName = function()
        "use strict";
        var dayName = ["SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"];
        return dayName[this.getDay()];
    };
    
  4. getDayName()
    Date.prototype.getDayName = function(){
      var d = new Date(+this);
      var dayName = d.getDay();
      switch(dayName) {
        case 0:
          return "Sunday";
          break;
        case 1:
          return "Monday";
    ...