Javascript Date getDayName()

Description

Javascript Date getDayName()


Date.prototype.getDayName = function() {
  var days = [/*from www  .j a  v a 2s. c o  m*/
    'Sunday',
    'Monday',
    'Tuesday',
    'Wednesday',
    'Thursday',
    'Friday',
    'Saturday'
  ];

  return days[this.getDay()];
}

Javascript Date getDayName()

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

Javascript Date getDayName()

Date.prototype.getDayName = function() {
 var d = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
 return d[this.getDay()];
};



PreviousNext

Related