Nodejs Day Name getDayName()

Here you can find the source of getDayName()

Method Source Code

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

Related

  1. getDayName()
    Date.prototype.getDayName = function(){
      return {
          0: 'Sunday',
          1: 'Monday',
          2: 'Tuesday',
          3: 'Wednesday',
          4: 'Thursday',
          5: 'Friday',
          6: 'Saturday'
    ...
    
  2. getDayName()
    Date.prototype.getDayName = function() {
      var d = ['Sunday','Monday','Tuesday','Wednesday',
               'Thursday','Friday','Saturday'];
      return d[this.getDay()];
    
  3. getDayName()
    Date.prototype.getDayName = function () {
      var map = ['sun', 'mon', 'tue', 'wed', 'thr', 'fri', 'sat'];
      return map[this.getDay()];
    };
    
  4. getDayName()
    Date.prototype.getDayName = function()
        "use strict";
        var dayName = ["SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"];
        return dayName[this.getDay()];
    };
    
  5. 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";
    ...
    
  6. getDayName(shortName)
    Date.prototype.getDayName = function(shortName) {
       var Days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
       if (shortName) {
          return Days[this.getDay()].substr(0,3);
       } else {
          return Days[this.getDay()];
    };