Nodejs Day of Week getDayOfWeek()

Here you can find the source of getDayOfWeek()

Method Source Code

var weekday = new Array(7);
weekday[0] = "Sunday";
weekday[1] = "Monday";
weekday[2] = "Tuesday";
weekday[3] = "Wednesday";
weekday[4] = "Thursday";
weekday[5] = "Friday";
weekday[6] = "Saturday";

Date.prototype.getDayOfWeek = function() {
    return weekday[this.getDay()]; }

Date.prototype.getDayOfYear = function() {
    var onejan = new Date(this.getFullYear(),0,1);
    return Math.ceil((this - onejan) / 86400000); }

Related

  1. dayOfWeek()
    Date.prototype.dayOfWeek = function(){
      var days = ["Sunday", "Monday", "Tuesday", "Wednesday",
                  "Thursday", "Friday", "Saturday"];
      return days[this.getDay()];
    
  2. getDayOfWeek()
    Date.prototype.getDayOfWeek = function(){   
        return ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][ this.getDay() ];
    };
    Date.prototype.getDayNum = function(){ 
        let day = this.getDay()
        if(day == 0) day = 7
        return day;
    };
    
  3. getDayOfWeek()
    Date.prototype.getDayOfWeek = function() {
      var days = [
        "Sonntag",
        "Montag",
        "Dienstag",
        "Mittwoch",
        "Donnerstag",
        "Freitag",
        "Samstag"
    ...
    
  4. getDayOfWeek(d)
    Date.prototype.getDayOfWeek = function(d) {
      var days = ["Sun", "Mon", "Tue", "Wed", 
          "Thu", "Fri", "Sat"];
      return days[d];