Advertisement

Latest Post

Wednesday, 28 September 2016

Jquery get month name by month number

Following is the common JQuery function get month  name by month number

function getMonthNameByMonthNumber(number) {
    var monthName = '';

    switch (number) {
        case 1:
            monthName = 'jan';
            break;
        case 2:
            monthName = 'feb';
            break;
        case 3:
            monthName = 'mar';
            break;
        case 4:
            monthName = 'apr';
            break;
        case 5:
            monthName = 'may';
            break;
        case 6:
            monthName = 'jun';
            break;
        case 7:
            monthName = 'jul';
            break;
        case 8:
            monthName = 'aug';
            break;
        case 9:
            monthName = 'sep';
            break;
        case 10:
            monthName = 'oct';
            break;
        case 11:
            monthName = 'nov';
            break;
        case 12:
            monthName = 'dec';
            break;
        Default:
          monthName='invalid number'
    }

    return monthName;

}

Government Jobs