Nodejs Month Name Get getMonthName()

Here you can find the source of getMonthName()

Method Source Code

Date.prototype.getMonthName = function() {
  switch(this.getMonth()) {
    case 0://from   www  .  j a  va 2  s .  co m
      return 'January';
    case 1:
      return 'February';
    case 2:
      return 'March';
    case 3:
      return 'April';
    case 4:
      return 'May';
    case 5:
      return 'June';
    case 6:
      return 'July';
    case 7:
      return 'August';
    case 8:
      return 'September';
    case 9:
      return 'October';
    case 10:
      return 'November';
    case 11:
      return 'December';
  }
}

Related

  1. getMonthName()
    monthName = ['January','February','March','April','May','June','July',
        'August','September','October','November','December'];
    Date.prototype.getMonthName = function() 
        return monthName[this.getMonth()]
    nDaysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
    function numberOfDaysInMonth(year, month)
        if (month != 1)
            return nDaysInMonth[month]
        else 
            year = parseInt(year)
            if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))
                return 29
            else return 28
    Date.prototype.getNumberOfDaysInMonth = function()
        var month = this.getMonth()
        var year = this.getYear()
        return numberOfDaysInMonth(year, month)        
    
  2. getMonthName()
    Date.prototype.monthNames = [
        "January", "February", "March",
        "April", "May", "June",
        "July", "August", "September",
        "October", "November", "December"
    ];
    Date.prototype.getMonthName = function() {
        return this.monthNames[this.getMonth()];
    };
    ...
    
  3. getMonthName()
    Date.prototype.getMonthName = function() {
        return Date.locale['en'].month_names[this.getMonth()];
    };
    Date.prototype.getMonthNameShort = function() {
        return Date.locale['en'].month_names_short[this.getMonth()];
    };
    Date.prototype.toShortString = function() {
      var s = this.getFullYear().toString() + this.getMonthNameShort();
      return s;
    ...
    
  4. getMonthName()
    Date.prototype.getMonthName = function() {
        var monthNames = ["January", "February", "March", "April", "May", "June",
        "July", "August", "Spetember", "October", "November", "December"];
        return monthNames[this.getMonth()];
    
  5. getMonthName()
    Date.prototype.getMonthName = function () {
      var map = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
      return map[this.getMonth()];
    };
    
  6. getMonthName()
    Date.prototype.getMonthName = function () {
      var monthNames = ["January", "February", "March", "April", "May", "June",
        "July", "August", "September", "October", "November", "December"
      ];
      return monthNames[this.getMonth()];
    };
    
  7. getMonthName(abbreviation)
    "use_strict";
    function getMonthName(index, abbreviation)
        abbreviation = (typeof abbreviation === 'boolean' && abbreviation);
        var abbrs = ['Jan','Feb','Mar','Apr','May','June','July','Aug','Sept','Oct','Nov','Dec'],
            names = ['January','February','March','April','May','June','July','August','September','October','November','December'];
        return abbreviation ? abbrs[ index ] : names[ index ];
    Date.prototype.getMonthName = function(abbreviation)
    ...
    
  8. getMonthName(i)
    Date.prototype.getMonthName = function(i)
        "use strict";
        var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
        if(i == months.length) 
            i = 0;
        return months[i];
    ...
    
  9. getMonthName(lang)
    Date.prototype.getMonthName = function(lang) {
        lang = lang && (lang in Date.locale) ? lang : 'en';
        return Date.locale[lang].month_names[this.getMonth()];
    };
    Date.prototype.getMonthNameShort = function(lang) {
        lang = lang && (lang in Date.locale) ? lang : 'en';
        return Date.locale[lang].month_names_short[this.getMonth()];
    };
    Date.locale = {
    ...